Useful commands for Magento 2

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 >> http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-mode.html >> http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-static-view.html

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 Reply