Magento 2 Command Line List– As we all know magento 2 comes with some predefined commands which enable us to use it easily. Using these commands we can perform an important task such as – clearing cache, enable/disable developer mode, reindexing etc. Here in this tutorial we are going to cover the important commands which are used in daily development life.
Magento 2 Command Line List | Useful Commands
There are following commands available in magento 2 –
-
Setup Commands
-
Setup Upgrade Command Line
Setup upgrade command is very simple you can upgrade the setup using the below command-
Upgrade Setup Command Line Example:
php bin/magento setup:upgrade
-
Cache Enable Command Line
You can enable cache using the below command –
Cache Enable Command Line Example:
php bin/magento cache:enable
-
Cache Disable Command Line
You can disable cache using the following command –
Cache Disable Command Line Example:
php bin/magento cache:disable
-
Cache Clean Command Line
Following command is used to clean cache in Magento-
Cache Clean Command Line Example:
php bin/magento cache:clean
-
Cache Flush Command Line
Cache Flush Command Line Example:
php bin/magento cache:flush
-
Cache Status Command Line
You can use the following command to check the cache status-
Cache Status Command Line Example:
php bin/magento cache:status
-
Indexer Commands
- Indexer Status Command Line
Following command is used to get the indexer status-
Indexer Status Command Line Example:
php bin/magento indexer:status
- Indexer Show Mode Command Line
Indexer Show Mode Command Line Example:
php bin/magento indexer:show-mode
- Indexer Reindex Command Line
Indexer Reindex Command Line Example:
php bin/magento indexer:reindex
- Indexer Info Command Line
Indexer Info Command Line Example:
php bin/magento indexer:info
-
Module Commands
- Enable Module Command Line
In magento 2 You can enable module using command line simply as below-
Enable Module Using Command Line Example:
php bin/magento module:enable ModuleName
- Disable Module Command Line
You can disable module using command line simply as below-
Disable Module Using Command Line Example:
php bin/magento module:disble ModuleName
- Uninstall Module Command Line–
In magento 2 You can uninstall module using command line simply as below-
Uninstall Module Using Command Line Example:
php bin/magento module:uninstall ModuleName
-
Other Commands
- Check Current Mode Command Line
You can check the current mode(Production/Development) using command line simply as below-
Check Mode(Development/Production) Module Using Command Line Example:
php bin/magento deploy:mode:show
- Set Developer Mode Command Line–
You can set the developer mode simply as below-
Enable Developer Mode Module Using Command Line Example:
php bin/magento deploy:mode:set developer
- Set Production Mode Command Line
You can set the production mode simply as below-
Set Production Mode Module Using Command Line Example:
php bin/magento deploy:mode:set production
- Run Single Tenant Compiler Command Line
Run Single Tenant Compiler Command Line Example:
php bin/magento setup:di:compile
- Set Static Content Deploy Command Line–
Set Static Content Deploy Command Line Example:
php bin/magento setup:static-content:deploy
- Set Static Content Deploy Command Line For Language
Set Static Content Deploy Command Line for language Example:
php bin/magento setup:static-content:deploy en_US
- Set Static Content Deploy Command Line FOr Theme
Set Static Content Deploy For theme Command Line Example:
php bin/magento setup:static-content:deploy --theme Magento/luma --theme Magento/Another_Theme
- Install Sample Data
Here is simple command to install the sample data in Magento.
Install Sample Data Command Line Example:
php bin/magento sampledata:install
- Run Cron
Run Cron Command Line Example:
php bin/magento cron:run