Useful commands for Magento 2

Have you recently migrated from Magento 1 and still learning about new commands to manage Magento 2? Want a quick guide of useful command lines for Magento 2? You have come to the right place. We have compiled a list of essential Magento 2 commands to make your work faster and easier. Keep the guide handy and get ready for efficient management of your e-commerce website.

Below are some useful commands for Magento 2

All magento 2 commands has to be executed from magento project root directory

1. For Re-indexing

php bin/magento indexer:reindex

2. For Flushing Cache

php bin/magento cache:flush

3. For Cleaning Cache

php bin/magento cache:clean

4. For Compilation

php bin/magento setup:di:compile

5. For Upgrading: This command is very useful as if you make any changes/install/set up magento module you will have to execute this command. Once this command execution completes, this will ask to re-run complilation command.

php bin/magento setup:upgrade

6. To check Magento Mode:: production/default OR developer

php bin/magento deploy:mode:show
php bin/magento deploy:mode:set developer
php bin/magento deploy:mode:set production

Please refer below articles for other commands and details of production/developer mode

7. To check Magento Module Status

php bin/magento module:status

8. For Static content deployment

php bin/magento setup:static-content:deploy
Leave a Comment