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 intead 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
php bin/magento cache:clean ==> php bin/magento c:c php bin/magento cache:disable ==> php bin/magento c:d php bin/magento cache:enable [cache_type] ==> php bin/magento c:e [cache_type] php bin/magento cache:flush [cache_type] ==> php bin/magento c:f [cache_type] php bin/magento cache:status ==> php bin/magento c:s
Where cache_type
is 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
The post Magento 2 Console Command Sortcuts appeared first on Excellence Technologies Magento Blog | Magento Tutorials | Magento Developer.