Advertisements

Boost in Magento 2 Command

Boost in Magento 2 Command – Tried for less typing while firing command. As working with Magento 2 we need to fire command multiple time while development

Custom bin/magento
  • alias m2='php bin/magento'
  • Use: m2 c:f
Fire command from any directory

This is the same as above that we are going to use an alias in it.

First, get a unique alias name like I am going to use rm2 where ‘r’ represents for me as Root Directory.

Then travel to the project root directory and fire  ‘pwd‘ command and copy-paste the output in the following manner:

alias rm2=’php [copy-paste-path]/bin/magento’

that’s it.

Now use it – rm2 c:f

The main idea behind this one is that we usually travel from one directory to another directory and when we have to fire any command we have to return back to project root directory or making use of multiple ‘../’ which is not helpful in the development phase.

For example, if you are in vendor directory (for R&D purpose or something similar) and suddenly you want to fire reindexing command then you don’t have to go back to root project directory and you can fire command from vendor directory using the custom alias and its work and can save time there

Commonly used command Short form

Setup upgrade:

php bin/magento s:up

Static Content Deploy:

php bin/magento s:s:d -f

Di Compile:

php bin/magento s:d:c

Reindexing:

php bin/magento i:rei

Status of Indexer:

php bin/magento i:st

Cache Flush:

php bin/magento c:f

Disable Cache:

php bin/magento c:d

Enable Cache:

​​​​​​php bin/magento c:e

Disables particular modules:

php bin/magento mo:d Vendor_Module

Enables particular modules:

php bin/magento mo:e Vendor_Module

Module status:

php bin/magento mo:s

Uninstall module:

php bin/magento mo:u (only work on module install using composer)

Enable Maintenance Mode:

php bin/magento ma:e

Disable Maintenance Mode:

php bin/magento ma:d

For more : https://magento.stackexchange.com/questions/223371/magento-2-list-of-command-shortcuts

Please comment below whatever every comes in your mind weather it is question, anger, suggestion, improvement. Please write down below. I want to hear you and if you want me to make a post on something or wanting snippet please that also you can mention in comment.

I will surely answer your comment not letting go unanswered or help you in your query.

Happy coding.

Thanks Again.

You all are the semicolon to my statements; Please support me; Thanks