Hire Me

Magento 2: How to Use Console Command Shortcuts?

In the realm of Magento 2, efficiency and productivity are essential for developers and administrators. One often overlooked feature that can greatly enhance your workflow is the use of console command shortcuts. These shortcuts allow you to quickly execute common commands, saving you valuable time and effort. In this blog post, we will explore how to leverage Magento 2 console command shortcuts effectively, helping you optimize your development process.

Understanding Magento 2 Console Commands

Before diving into shortcuts, let’s quickly recap the significance of Magento 2 console commands. The Magento 2 command-line interface (CLI) empowers developers to perform various tasks, such as clearing cache, compiling code, reindexing data, and more. The CLI provides a convenient way to interact with your Magento store without the need for a graphical user interface (GUI).

You can check the entire list of commands by running this command:

php bin/magento list

Why Use Console Command Shortcuts?

By default, executing Magento 2 console commands requires typing lengthy commands each time. This process can be time-consuming, especially when working on repetitive tasks. Console command shortcuts provide a solution by allowing you to create abbreviated versions of frequently used commands. These shortcuts significantly reduce typing effort and enhance your efficiency.

This shortcut 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

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

Best Practices for Console Command Shortcuts

To make the most of Magento 2 console command shortcuts, keep the following best practices in mind:

  • Choose intuitive and memorable aliases to ensure easy recall.
  • Document your shortcuts for future reference or to share them with your team.
  • Regularly review and update your shortcuts to adapt to evolving development requirements.
  • Be cautious when creating shortcuts to avoid potential conflicts with existing commands.


Magento 2 console command shortcuts are a valuable asset for developers and administrators seeking to optimize their workflow. By implementing these shortcuts, you can save time, reduce typing effort, and improve overall productivity. Take advantage of this powerful feature and explore the possibilities it offers. With Magento 2 console command shortcuts in your arsenal, you’ll be able to streamline your development process like never before.

Remember, every second saved adds up to increased efficiency and success in your Magento 2 endeavors. Start leveraging console command shortcuts today and experience the benefits firsthand!

Happy coding! 🙂

Note: When implementing these shortcuts, ensure you have the necessary permissions and backup your Magento installation to avoid any unintended consequences.

About Author

Leave a Reply

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