Table of contents
One of the most useful improvements of Magento 2 over its predecessor is its built-in Command Line Interface (CLI) tool. This powerful tool allows you to perform a wide variety of tasks including installation, configuration, database backups, compiling LESS etc. And if you’re familiar with Magneto CLI, writing and rewriting the same command lines over and over again would feel inefficient at times. However, what most Magento developers don’t know is that you can shorten your command lines with shortcuts.
The most popular CLI commands used in Magento 2
To help you quickly perform your tasks, we have put together the list of most frequently used command shortcuts in Magento 2.
Catalog
Create resized product images
php bin/magento c:i:r
Remove unused product attributes
php bin/magento c:p:a:r
Setup
Install Magento
php bin/magento s:i
Uninstall Magento
php bin/magento s:un
Upgrade the current Magento application, DB data, and schema
php bin/magento s:up
Notes: If you don’t want to remove pub/static files while installing/updating a database, use the following command.
php bin/magento s:up --keep-generated
Sample data
Deploy sample data modules
php bin/magento sa:d
Remove sample data packages from composer.json
php bin/magento sa:rem
Reset all sample data modules for re-installation
php bin/magento sa:res
Cache
Check cache status
php bin/magento c:s
Cache Clean
php bin/magento c:c
Cache Flush
php bin/magento c:f
Disable Cache
php bin/magento c:d
Enable Cache
php bin/magento c:e
Indexer
Reindexing
php bin/magento i:rei
View the list of indexers
php bin/magento i:i
View indexer status
php bin/magento i:st
View indexer Resets
php bin/magento i:res
Show the mode of all indexers
php bin/magento i:sh
Deploying
Check Current Mode
php bin/magento d:m:sh
Change To Developer Mode
php bin/magento d:m:se developer
Change To Production Mode
php bin/magento d:m:se production
Static Content Deploy
php bin/magento s:s:d
Static Content Deploy For Particular Language
php bin/magento s:s:d en_US
Static Content Deploy For Magento Backend theme
php bin/magento s:s:d --theme="Magento/backend"
Static Content Deploy For Specific Themes
php bin/magento s:s:d --theme Magento/luma --theme Magento/second_theme
Exclude Themes on Static Content Deploy and does not minify HTML
php bin/magento s:s:d en_US --exclude-theme Magento/luma --no-html-minify
Di Compile
php bin/magento s:d:c
Modules
See all modules Status
php bin/magento mo:s
Enable module
php bin/magento mo:e Namespace_Module
Disable module
php bin/magento mo:d Namespace_Module
Uninstall Module
php bin/magento mo:u Namespace_Module
Dev
Run tests
php bin/magento d:t:r
Cron
Run scheduled jobs
php bin/magento c:r
Run cron jobs scheduled for setup application
php bin/magento s:c:r
Hope that helps!
Read more:
How to Deploy Static Content in Magento 2
Magento 2 Events List and How to Use Them