Magento 2 Useful Commands

Home / Magento2 / Magento 2 Useful Commands

Here you see list of some use full command for magento2 development and customization.
For these commands you need to have SSH access to your server or use the Command Line for local access.
These commands are run within the /magento2 folder and reference the /magento2/bin folder.

Magento 2 Cache Commands

To flush Magento 2 cache:

Go to Magento root directory
php bin/magento cache:clean
php bin/magento cache:flush

Magento 2 cache status

php bin/magento cache:status

Magento 2 cache clean

php bin/magento cache:clean

Magento 2 disable cache

Command will disable all cache types

php bin/magento cache:disable

Disable specific cache type

php bin/magento cache:disable CACHE_TYPE
Like: php bin/magento cache:disable config

Magento 2 Enable cache

All cache types

php bin/magento cache:enable

Specific cache type
php bin/magento cache:enable CACHE_TYPE
Like: php bin/magento cache:enable layout

Magento 2 Reindexing Using Command Line

php bin/magento indexer:reindex

View the list of indexers Using Command Line

php bin/magento indexer:info

View indexer status Using Command Line

php bin/magento indexer:status

Show the mode of all indexers Using Command Line

php bin/magento indexer:show-mode

Magento 2 Module Command

List enabled and disabled modules

php bin/magento module:status

Enable module Using Command Line

php bin/magento module:enable Namespace_Module

Disable module Using Command Line

php bin/magento module:disable Namespace_Module

Uninstall Module Using Command Line

php bin/magento module:uninstall Namespace_Module

php bin/magento setup:upgrade

For Static content deployment

php bin/magento setup:static-content:deploy

Show current Mode Using Command Line
php bin/magento deploy:mode:show

Change To Developer Mode Using Command Line

php bin/magento deploy:mode:set developer

Change To Production Mode Using Command Line

php bin/magento deploy:mode:set production

Remove the maintenance mode

php bin/magento maintenance:disable

Run the single-tenant compiler

php bin/magento setup:di:compile

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *