MagentoPHP

Magento 2 Useful Commands

By October 12, 2017 No Comments

Most useful commands SSH / CLI commands for Magento 2 that I have found useful. To use these commands you will need to have SSH access to your server or use the Command Line for local access.

Setup Upgrade Using  SSH / CLI

php bin/magento setup:upgrade

If you don’t want to remove pub/static files while installing/updating database then use following command.

php bin/magento setup:upgrade –keep-generated

Run the single-tenant Compiler Using SSH / CLI

php bin/magentosetup:di:compile

 Cache Clean Using  SSH / CLI

php bin/magento cache:clean

Change To Developer Mode Using SSH / CLI

php bin/magento deploy:mode:set developer

Change To Production Mode Using SSH / CLI

php bin/magento deploy:mode:set production

Cache Flush Using  SSH / CLI

php bin/magento cache:flush

View cache status Using  SSH / CLI

php bin/magento cache:status

Enable/Disable Cache Using  SSH / CLI

php bin/magento cache:enable/disable   [cache_type]

Static Content Deploy Using SSH / CLI

php bin/magento setup:static-content:deploy

Static Content Deploy for Store Language Using SSH / CLI

php bin/magento setup:static-content:deploy en_US

Static Content Deploy For Magento Backend Theme Using SSH / CLI (Working on 2.1.1 or later)

php bin/magento setup:static-content:deploy –theme=”Magento/backend”

Static Content Deploy For Specific Themes Using SSH / CLI (Working on 2.1.1 or later)

php bin/magento setup:static-content:deploy –theme Magento/luma –theme Magento/second_theme

Exclude Themes on Static Content Deploy and does not minify HTML files Using SSH / CLI (Working on 2.1.1 or later)

php bin/magento setup:static-content:deploy en_US –exclude-theme Magento/luma –no-html-minify

Reindexing Using SSH / CLI

php bin/magento indexer:reindex

View the list of indexers Using SSH / CLI

php bin/magento indexer:info

View indexer status Using SSH / CLI

php bin/magento indexer:status

Show the mode of all indexers Using SSH / CLI

php bin/magento indexer:show-mode

See all modules Status Using SSH / CLI

php bin/magento module:status

Enable module Using Command SSH / CLI

php bin/magento module:enable Namespace_Module

Disable module Using Command SSH / CLI

php bin/magento module:disable Namespace_Module

Uninstall Module Using SSH / CLI

php bin/magento module:uninstall Namespace_Module

Check Current Mode Using SSH / CLI

php bin/magento deploy:mode:show