Hire Me
Magento 2 Console Command Shortcuts

Magento 2 Console Command Shortcuts

While working on Magento 2.x, you often need to run several console commands which are actually very handy in terms of managing the things such as cache, upgrades, deploy modes, indexers etc. You can check the entire list of commands by running this command:

php bin/magento list

Well, typing the full long commands are not very pleasant if it has to be done multiple times. So, we can use shortcuts instead full commands. This feature comes due to the Symphony framework which is used by each console class that implement command line functionality. The use Symfony\Component\Console\Command component to implement command line features. You can learn more in the documentation of Symphony framework. You can use shortest unambiguous name instead of full name, e.g. s instead of setup.

Now, let’s see shortcuts for some of the commonly used Magento 2 console commands:

1. Cache Commands

Generally we use the cache commands like cache:clean, cache:flush and cache:status like this:

php bin/magento cache:clean

But, Symphony framework allows you to use shortcuts like this:

php bin/magento c:c

You may pass the parameters as well like cache_type (the parameter in which you can pass one or more cache types separated by whitespaces). e.g.

php bin/magento c:c config layout

2. Indexer Commands

php bin/magento indexer:reindex ==> php bin/magento i:rei 
php bin/magento indexer:info ==> php bin/magento i:i 
php bin/magento indexer:status ==> php bin/magento i:sta 
php bin/magento indexer:show-mode ==> php bin/magento i:sho 
php bin/magento indexer:reset ==> php bin/magento i:res

You may pass parameters for particular indexer type as well.

3. Compile Command

php bin/magento setup:di:compile ==> php bin/magento s:di:c

4. Setup Upgrade Command

php bin/magento setup:upgrade ==> php bin/magento s:up

5. Static Content Deploy Command

php bin/magento setup:static-content:deploy ==> php bin/magento s:s:d

6. Module Management Commands

php bin/magento module:status ==> php bin/magento mo:s 
php bin/magento module:disable Namespace_Module ==> php bin/magento mo:d Namespace_Module
php bin/magento module:enable Namespace_Module ==> php bin/magento mo:e Namespace_Module
php bin/magento module:uninstall Namespace_Module ==> php bin/magento m:u Namespace_Module

If you need any more help, feel free to leave a comment or contact me.

Leave a Reply

Your email address will not be published. Required fields are marked *