Magento 2 - Command line interface (CLI) commands
If you are a Magento developer, we are sure that you would have thought or wished to have all frequently used CLI commands in one list. Well, we went ahead and made that basic list for everyone’s reference.
In this article, we will try to summarise the CLI commands that are available in Magento 2 by default.
We will also discuss and explore each of these commands in-depth in our future articles, so keep
visiting Hungersoft.com for more.
For now, following are the commands available to you during Magento 2 development:
Note: You should run following commands from your Magento 2 root directory
Cache:
Manage cache:
php bin/magento setup:cache:{clean|flush|enable|disable|status}
Setup:
Take Backup:
Run cron jobs scheduled for setup application:
php bin/magento setup:cron:run
Install/Upgrade DB data:
php bin/magento setup:db-data:upgrade
Install/Upgrade DB schema:
php bin/magento
setup:db-schema:upgrade
Check DB data/schema status:
php bin/magento setup:db:status
Install store configuration:
php bin/magento setup:store-config:set
Set deployment configuration:
php bin/magento setup:config:set
Upgrade Magento application, db data and schema:
php bin/magento setup:upgrade
Compile code:
Use the following command when you a single
instance of Magento application:
php bin/magento setup:di:compile
Use the following command when you have more than one independent instance of Magento application using one command Magento code base.
php bin/magento setup:di:compile-multi-tenant
Deploying static view files:
php bin/magento setup:static-content:deploy
Rollback codebase, media and database:
php bin/magento
setup:rollback
Performance testing data:
php bin/magento setup:perf:generate-fixtures
Uninstall Magento application:
php bin/magento setup:uninstall
Deploy:
Manage deployment mode:
php bin/magento deploy:mode:{set|show}
Module:
Manage modules:
php bin/magento module:{enable|disable|status|uninstall}
Theme:
Uninstall:
php bin/magento
theme:uninstall
Indexer:
Manage Indexing and indexers:
php bin/magento setup:indexer:{status|info|reindex|show-mode|set-mode|reset}
Cron:
Run cron jobs by schedule:
php bin/magento
cron:run
Translation:
Create translation dictionary/package:
php bin/magento i18n:{collect-phrases|pack|uninstall}
Maintenance:
Manage maintenance mode:
php bin/magento
maintenance:{enable|disable|status|allow-ips}
Info:
Display admin URI:
php bin/magento info:adminuri
List backups:
php bin/magento info:backups:list
List currency:
php bin/magento info:currency:list
List language:
php bin/magento info:language:list
List timezone:
php bin/magento info:timezone:list
Show dependencies:
php bin/magento info:dependencies:{show-modules|show-framework|show-modules-circular}
Dev:
Collect and publish source files for theme:
php bin/magento
dev:source-theme:deploy
Convert layout XML (Extensible Markup Language) using XSL (Extensible Stylesheet Language) stylesheets:
php bin/magento dev:xml:convert
Run dev tests:
php bin/magento
dev:tests:run
Generate catalog of URNs to *.xsd mappings:
php bin/magento dev:urn-catalog:generate
Sampledata:
Install sample data:
php bin/magento
sampledata:{deploy|remove|reset}
Admin User:
Mange admin user:
php bin/magento admin:user{create|unlock}
Customer:
Upgrade customer hash:
php bin/magento
customer:hash:upgrade
Catalog:
Create resized product images:
php bin/magento catalog:images:resize
Remove unused product attributes:
php bin/magento
product:attributes:cleanup
App:
Create dump of application:
php bin/magento app:config:dump