Here you can find a list of essential Magento 2 commands to make your work faster and easier.
All magento 2 commands has to be executed from magento project root directory
Setup Upgrade Using Command Line
1 2 3 | php bin/magento setup:upgrade php bin/magento setup:upgrade --keep-generated //If you don’t want to remove pub/static files while installing/updating database |
Cache Clean/Flush:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // Clean or Flush Cache php bin/magento cache:clean php bin/magento cache:flush //View cache status: php bin/magento cache:status //Enable/Disable Cache: php bin/magento cache:enable [cache_type] php bin/magento cache:disable [cache_type] //Enable/Disable Cache: php bin/magento cache:enable [cache_type] php bin/magento cache:disable [cache_type] |
Static Content Deploy:
1 2 3 4 5 6 7 8 9 10 | php bin/magento setup:static-content:deploy //For Particular Language php bin/magento setup:static-content:deploy en_US //For Magento Backend Theme Using Command Line (Working on 2.1.1 or later php bin/magento setup:static-content:deploy --theme="Magento/backend" //For Specific Themes php bin/magento setup:static-content:deploy --theme Magento/luma --theme Magento/new_theme |
Reindexing Using Command Line
1 | php bin/magento indexer:reindex |
Module
1 2 3 4 5 6 7 8 9 10 11 | //Module Status php bin/magento module:status //Enable module php bin/magento module:enable Namespace_Module //Disable module php bin/magento module:disable Namespace_Module //Uninstall Module php bin/magento module:uninstall Namespace_Module |
Site Mode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | //Check Current Mode php bin/magento deploy:mode:show //Change To Developer Mode php bin/magento deploy:mode:set developer //Change To Production Mode php bin/magento deploy:mode:set production //Enable Maintenance Mode php bin/magento maintenance:enable //Disable Maintenance Mode php bin/magento maintenance:disable //Check Maintenance Mode Status php bin/magento maintenance:status |
Run the Compiler
1 | php bin/magento setup:di:compile |
Many thanks sharing this post and making it public