[email protected] +44 20 7193 0206
Common Magento 2 SSH Commands
10th October, 2018

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.

  1. 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)
  2. 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
  3. bin/magento indexer:reindex
    Triggers a full reindex, dangerous when other people are working on products etc.
  4. bin/magento indexer:reset
    Resets the indexer status, they will reindex in the background on next cron, much safer when the site is busy.
  5. bin/magento indexer:status
    Check status of indexes, you can use this to monitor the progress of background reindexing
  6. bin/magento maintenance:enable; bin/magento maintenance:disable
    Switching Maintenance Mode on/off – I guess do not use these together
  7. bin/magento deploy:mode:show
    Shows what mode Magento is in, Developer, Default or Production.
  8. bin/magento deploy:mode:set
    Allow you to set what mode to put Magento in; production, developer or default.
  9. 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.
  10. bin/magento cron:install
    Creates the cron jobs without you having to think or know anything!
  11. 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.