Common Magento 2 SSH Commands
10th October, 2018
0
As someone relatively new to Magento 2, yet a long time user of Magento 1, I thought I publish a list of common Magento 2 SSH commands that I seem to be frequenttly using.
I’m guessing this post is more for developers than our clients, but it could still be helpful, I hope.
For our servers we did not need to prepend with php.
- bin/magento setup:upgrade; bin/magento setup:di:compile;
Use to Upgrade database schema, activate new modules, and then recompile.
(the semi-colon allows you to queue multiple commands) - bin/magento cache:clean; bin/magento cache:flush;
Either individual or together, Clean means an immediate clean up of all Cache, Flush indicates a deeper level of cache clearing including JS and CSS - bin/magento indexer:reindex
Triggers a full reindex, dangerous when other people are working on products etc. - bin/magento indexer:reset
Resets the indexer status, they will reindex in the background on next cron, much safer when the site is busy. - bin/magento indexer:status
Check status of indexes, you can use this to monitor the progress of background reindexing - bin/magento maintenance:enable; bin/magento maintenance:disable
Switching Maintenance Mode on/off – I guess do not use these together - bin/magento deploy:mode:show
Shows what mode Magento is in, Developer, Default or Production. - bin/magento deploy:mode:set
Allow you to set what mode to put Magento in; production, developer or default. - bin/magento static-content:deploy <locale>
e.g. bin/magento static-content:deploy en_GB or bin/magento static-content:deploy fr_FR
Sometimes there is a need to deploy static content for other locales after going to production. - bin/magento cron:install
Creates the cron jobs without you having to think or know anything! - bin/magento cron:remove
Kills all Cron jobs should it ever need necessary.
Well, I guess I hope this list helps some people – feel free to add your own favourite Commands here, or correct any of the above as needed.