Home / Magento / Magento 2 Command List

Magento 2 Command List

If you want to run command on magento 2. You need to first follow the step.
Step 1: Need to use cmd command. so go to your start menu > RUN then type cmd & open it. Type which drive you you have xampp/local server where you have magento 2.  I have magento 2 on D Drive xamp folder. Type follow command
# D:
# D:\xamp\htdocs\your_magento2_folder_name

Now Type Following Command for Magento 2.
Example Command:
# php bin/magento setup:upgrade

Setup Upgrade (if you install modules/extensions)

php bin/magento setup:upgrade

 * If you install module then you can use setup:upgrade Command. Note it if you use this command you pub/static files will be gone for this your backend and frondend lost the js-css files so all will be broken. For this use content static deploy for regenerate all files.  if you don’t want to remove pub/static files please run the bellow command.

php bin/magento setup:upgrade –keep-generated

Static Content Deploy ( regenerate pub/static css-js files)

php bin/magento setup:static-content:deploy

Cache Clean (To Clean the cache)

php bin/magento cache:clean

Cache Flush (remove all cache)

php bin/magento cache:flush

View cache status 

php bin/magento cache:status

Enable Cache 

php bin/magento cache:enable

Disable Cache 

php bin/magento cache:disable

Static Content Deploy For Language

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

Static Content Deploy For Magento Backend Theme (Working on 2.1.1 or later)

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

Static Content Deploy For Specific Themes  (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 (Working on 2.1.1 or later)

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


Reindexing 

php bin/magento indexer:reindex


View the list of indexers

php bin/magento indexer:info

View indexer status

php bin/magento indexer:status

Show the mode of all indexers

php bin/magento indexer:show-mode

See all modules Status

php bin/magento module:status

Enable module

php bin/magentomodule:enable Namespace_Module

Disable module 

php bin/magento module:disable Namespace_Module

Uninstall Module 

php bin/magento module:uninstall Namespace_Module

Check Current Mode 

php bin/magento deploy:mode:show

Change To Developer Mode 

php bin/magentodeploy:mode:setdeveloper

Change To Production Mode 

php bin/magentodeploy:mode:set production

Run the single-tenant Compiler 

php bin/magentosetup:di:compile

Hits: 4

Leave a Reply