Magento SSH/CLI commands

EXPERIENCING PROBLEMS WITH OUR SERVICES? RUN A DIAGNOSE FIRST TO SAVE YOURS AND OUR TIME

Added: 07.07.2020 15:51:36     Last updated: 07.07.2020 15:51:36

Magento SSH/CLI commands

If one uses Magento 2 then it is necessary to use SSH / CLI commands to perform necessary tasks. The Magento documentation can be confusing and the commands are not located in the same place, so we have compiled the most useful and most used commands.

The commands below assume that one is in the same directory as the website itself.

1. Help
The command below will list sub commands and parameters that can be used.

php bin/magento help


2. List of commands
This will list all possible commands one can run for Magento 2.

php bin/magento list


3. Cache
Show cache status.

php bin/magento cache:status

Flush cache. Purges the whole cache folder.

php bin/magento cache:flush

Clean cache.

php bin/magento cache:clean


4. Mode
See the status of the mode in use.

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

5. Maintenance
Check the status of the page for maintenance.

php bin/magento maintenance:status

6. Indexing
This shows the status of the indexes.

php bin/magento indexer:status

Reindexing

php bin/magento indexer:reindex

7. Modules
This shows modules that are installed.

php bin/magento module:status