Magento 2 Useful CLI/SSH Commands List

Magento 2 Useful CLI SSH Commands List

Hello, Magneto pals

If you have just started working on Magento 2 CMS or are working with it for quite a few times, you must know these useful CLI/SSH commands that will help you complete certain tasks at ease. 

Magento CLI/SSH command can come really handy when you have to clean cache, Enable – disabling cache, run cron, Data indexing, and various other tasks. To run these SSH commands, you need to have SSh access to your server, or you can use the command line for local access. 

So, to save your most precious thing – time – we would like to suggest all the developers and other interested people to bookmark this post. This is a compilation of all the useful SSH/CLI commands for Magento2. 

Command description CommandShortcodes
Displays help for a commandphp bin/magento help (command)php bin/magento h
Check the list of all commands –

This will help list all the commands for Magento2

php bin/magento listphp bin/magento
To clean cachephp bin/magento cache:cleanphp bin/magento c:c
To disable cachephp bin/magento cache:disablephp bin/magento c:d
To enable cache php bin/magento cache:enablephp bin/magento c:e
To flush or refresh cachephp bin/magento cache:flushphp bin/magento c:f
To check the status of the cachephp bin/magento cache:statusphp bin/magento c:s
To create user in Magento php bin/magento admin:user:createphp bin/magento a:u:c
To unlock your admin accountphp bin/magento admin:user:unlockphp bin/magento a:u:u
To create the dump of the application php bin/magento app:config:dump
To import data from shared files to appropriate data storagephp bin/magento app:config:import
To resize an image php bin/magento catalog:images:resizephp bin/magento c:i:r
To remove unused product attribute php bin/magento catalog:product:attribute:cleanup php bin/magento c:p:a:c
To set sensitive configuration valuesphp bin/magento config:sensitive:set
To change system configurationphp bin/magento config:set
To show configuration value for given path. If path not specified, then all values will be shownphp bin/magento config:show
To generate and install crontab for current userphp bin/magento cron:install
To remove the tasks from crontab php bin/magento cron:remove
To run jobs as per schedulephp bin/magento cron:runphp bin/magento c:r
To upgrade customer’s hash according to the latest algorithmphp bin/magento customer:hash:upgradephp bin/magento c:h:u
To set application modephp bin/magento deploy:mode:setphp bin/magento d:m:set
To display current application modephp bin/magento deploy:mode:showphp bin/magento d:m:sho
To get information on dependency injection configuration for the commandphp bin/magento dev:di:info
To disable DB query loggingphp bin/magento dev:query-log:disable
To enable DB query loggingphp bin/magento dev:query-log:enable
To collect and publish source files for the theme.php bin/magento dev:source-theme:deployphp bin/magento d:s:d
To disable frontend template hints. A cache flush required.php bin/magento dev:template-hints:disable
To enable frontend template hints. A cache flush required.php bin/magento dev:template-hints:enable
To runs testsphp bin/magento dev:tests:runphp bin/magento d:t:r
To generates the catalog of URNs to *.xsd mappings for the IDE to highlight xml.php bin/magento dev:urn-catalog:generatephp bin/magento d:u:g
To convert XML file using XSL style sheetsphp bin/magento dev:xml:convertphp bin/magento d:x:c
To shows allowed Indexersphp bin/magento indexer:infophp bin/magento i:i
To reindexes Dataphp bin/magento indexer:reindexphp bin/magento i:rei
To reset indexer status to invalidphp bin/magento indexer:resetphp bin/magento i:res
To set index mode typephp bin/magento indexer:set-modephp bin/magento i:set
To show index modephp bin/magento indexer:show-modephp bin/magento i:sho
To shows status of indexerphp bin/magento indexer:statusphp bin/magento i:sta
To discover phrases in the codebasephp bin/magento i18n:collect-phrasesphp bin/magento i1:c
To saves language packagephp bin/magento i18n:packphp bin/magento i1:p
To uninstall language packagesphp bin/magento i18n:uninstallphp bin/magento i1:u
Displays the Magento Admin URIphp bin/magento info:adminuriphp bin/magento i:a
Prints list of available backup filesphp bin/magento info:backups:listphp bin/magento i:b:l
Displays the list of available currenciesphp bin/magento info:currency:listphp bin/magento i:c:l
Shows number of dependencies on Magento frameworkphp bin/magento info:dependencies:show-frameworkphp bin/magento i:d:show-f
Shows number of dependencies between modulesphp bin/magento info:dependencies:show-modules
Shows number of circular dependencies between modulesphp bin/magento info:dependencies:show-modules-circular
Displays the list of available language localesphp bin/magento info:language:listphp bin/magento i:l:l
Displays the list of available timezonesphp bin/magento info:timezone:listphp bin/magento i:t:l
Sets maintenance mode exempt IPsphp bin/magento maintenance:allow-ipsphp bin/magento m:a
Disables maintenance modephp bin/magento maintenance:disablephp bin/magento ma:d
Enables maintenance modephp bin/magento maintenance:enablephp bin/magento ma:e
Displays maintenance mode statusphp bin/magento maintenance:statusphp bin/magento ma:s
Disables specified modulesphp bin/magento module:disablephp bin/magento mo:d
Enables specified modulesphp bin/magento module:enablephp bin/magento mo:e
Displays status of modulesphp bin/magento module:statusphp bin/magento mo:s
Uninstalls modules installed by composerphp bin/magento module:uninstallphp bin/magento m:u
Deploy sample data modulesphp bin/magento sampledata:deployphp bin/magento sa:d
Remove all sample data packages from composer.jsonphp bin/magento sampledata:removephp bin/magento sa:rem
Reset all sample data modules for re-installationphp bin/magento sampledata:resetphp bin/magento sa:res
Takes backup of Magento Application code base, media and databasephp bin/magento setup:backupphp bin/magento s:b
Creates or modifies the deployment configurationphp bin/magento setup:config:setphp bin/magento s:c:s
Runs cron job scheduled for setup applicationphp bin/magento setup:cron:runphp bin/magento s:c:r
Installs and upgrades data in the DBphp bin/magento setup:db-data:upgradephp bin/magento s:db-d:u
Installs and upgrades the DB schemaphp bin/magento setup:db-schema:upgradephp bin/magento s:db-s:u
Checks if DB schema or data requires upgradephp bin/magento setup:db:statusphp bin/magento s:d:s
Generates DI configuration and all missing classes that can be auto-generatedphp bin/magento setup:di:compilephp bin/magento s:d:c
Installs the Magento applicationphp bin/magento setup:installphp bin/magento s:i
Generates fixturesphp bin/magento setup:performance:generate-fixturesphp bin/magento s:p:g
Rolls back Magento Application codebase, media and databasephp bin/magento setup:rollbackphp bin/magento se:r
Deploys static view filesphp bin/magento setup:static-content:deployphp bin/magento s:s:d
Installs the store configuration. Deprecated since 2.2.0. Use config:set insteadphp bin/magento setup:store-config:setphp bin/magento s:s:s
Uninstalls the Magento applicationphp bin/magento setup:uninstallphp bin/magento s:un
Upgrades the Magento application, DB data, and schemaphp bin/magento setup:upgradephp bin/magento s:up
Displays the list of storesphp bin/magento store:list
Displays the list of websitesphp bin/magento store:website:list
Uninstalls themephp bin/magento theme:uninstallphp bin/magento t:u
Generates varnish VCL and echos it to the command linephp bin/magento varnish:vcl:generate

 

So, this was it for the day. To learn more about commands, you can check the Official Guide from Magento. We hope that this will help you save a lot more time so that you can focus more on your work. 

If you find that some of the commands are missing, then do let us know in the comments below. Also, please share this with your Magento colleagues and partners.

Hire Magento 2 Developer

Previous Article

How to Fix Issues Found with Your Review Snippet Markup In Search Console?

Next Article

Magento 2: Remove Decimal From Quantity In Product Grid In Magento Admin

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨