Get started with Magento 2 SSH/ CLI commands

If you are working with Magento 2 CMS, you must be familiar with these commands. To make development easier and more handy to run indexer, flush command, running cron etc Magento introduces these commands. 

To find out all commands in a single place you can refer to this post. Below is the list of most important SSH / CLI commands for Magento 2. You need to have SSH access to your server, or you can use the command line for local access.

AVAILABLE SSH COMMANDSSHORTCUTSDESCRIPTION
php bin/magento –versionphp bin/magento -VTo display this application version
php bin/magento –help
php bin/magento help
php bin/magento -hTo display help message for command
php bin/magento listphp bin/magento lTo list all Magento 2 commands
ADMIN
php bin/magento admin:user:createphp bin/magento a:u:cCreates an administrator
php bin/magento admin:user:unlockphp bin/magento a:u:uUnlock Admin Account
APP
php bin/magento app:config:dumpphp bin/magento a:c:dCreate dump of application
php bin/magento app:config:importphp bin/magento a:c:iImport data from shared configuration files to appropriate data storage
php bin/magento app:config:statusphp bin/magento a:c:sChecks if config propagation requires update
CACHE
php bin/magento cache:cleanphp bin/magento c:cCleans cache type(s)
php bin/magento cache:disablephp bin/magento c:dDisables cache type(s)
php bin/magento cache:enablephp bin/magento c:eEnables cache type(s)
php bin/magento cache:flushphp bin/magento c:fFlushes cache storage used by cache type(s)
php bin/magento cache:statusphp bin/magento c:sChecks cache status
CATALOG
php bin/magento catalog:images:resizephp bin/magento c:i:rCreates resized product images
php bin/magento catalog:product:attributes:cleanupphp bin/magento c:p:a:cRemoves unused product attributes.
CONFIG
php bin/magento config:sensitive:setphp bin/magento c:s:sSet sensitive configuration values
php bin/magento config:setphp bin/magento c:setChange system configuration
php bin/magento config:showphp bin/magento c:showShows configuration value for given path. If path is not specified, all saved values will be shown
CRON
php bin/magento cron:installphp bin/magento c:installGenerates and installs crontab for current user
php bin/magento cron:removephp bin/magento c:removeRemoves tasks from crontab
php bin/magento cron:runphp bin/magento c:runRuns jobs by schedule
CUSTOMER
php bin/magento customer:hash:upgradephp bin/magento c:h:uUpgrade customer’s hash according to the latest algorithm
DEPLOY
php bin/magento deploy:mode:setphp bin/magento d:m:setSet application mode.
php bin/magento deploy:mode:showphp bin/magento d:m:showDisplays current application mode.
DEV
php bin/magento dev:di:infophp bin/magento d:d:iProvides information on Dependency Injection configuration for the Command.
php bin/magento dev:profiler:disablephp bin/magento d:p:dDisable the profiler.
php bin/magento dev:profiler:enablephp bin/magento d:p:eEnable the profiler.php bin/magento
php bin/magento dev:query-log:disablephp bin/magento d:q:dDisable DB query logging
php bin/magento dev:query-log:enablephp bin/magento d:q:eEnable DB query logging
php bin/magento dev:source-theme:deployphp bin/magento d:s:dCollects and publishes source files for theme.
php bin/magento dev:template-hints:disablephp bin/magento d:t:dDisable frontend template hints. A cache flush might be required.
php bin/magento dev:template-hints:enablephp bin/magento d:t:eEnable frontend template hints. A cache flush might be required.
php bin/magento dev:tests:runphp bin/magento d:t:rRuns tests
php bin/magento dev:urn-catalog:generatephp bin/magento d:u:gGenerates the catalog of URNs to *.xsd mappings for the IDE to highlight xml.
php bin/magento dev:xml:convertphp bin/magento d:x:cConverts XML file using XSL style sheets
DOTDIGITAL
php bin/magento dotdigital:migratephp bin/magento dot:mMigrate data into email_ tables to sync with Engagement Cloud
php bin/magento dotdigital:syncphp bin/magento dot:sRun syncs to populate email_ tables before importing to Engagement Cloud
DOWNLOADABLE
php bin/magento downloadable:domains:addphp bin/magento d:d:aAdd domains to the downloadable domains whitelist
php bin/magento downloadable:domains:removephp bin/magento d:d:rRemove domains from the downloadable domains whitelist
php bin/magento downloadable:domains:showphp bin/magento d:d:sDisplay downloadable domains whitelist
ENCRYPTION
php bin/magento encryption:payment-data:updatephp bin/magento e:p:uRe-encrypts encrypted credit card data with latest encryption cipher.
I18N
php bin/magento i18n:collect-phrasesDiscovers phrases in the codebase
php bin/magento i18n:packSaves language package
php bin/magento i18n:uninstallUninstalls language packages
INDEXER
php bin/magento indexer:infoShows allowed Indexers
php bin/magento indexer:reindexReindexes Data
php bin/magento indexer:resetResets indexer status to invalid
php bin/magento indexer:set-dimensions-modeSet Indexer Dimensions Mode
php bin/magento indexer:set-modeSets index mode type
php bin/magento indexer:show-dimensions-modeShows Indexer Dimension Mode
php bin/magento indexer:show-modeShows Index Mode
php bin/magento indexer:statusShows status of Indexer
INFO
php bin/magento info:adminuriphp bin/magento info:aDisplays the Magento Admin URI
php bin/magento info:backups:listphp bin/magento info:b:lPrints list of available backup files
php bin/magento info:currency:listphp bin/magento info:c:lDisplays the list of available currencies
php bin/magento info:dependencies:show-frameworkShows number of dependencies on Magento framework
php bin/magento info:dependencies:show-modulesShows number of dependencies between modules
php bin/magento info:dependencies:show-modules-circularShows number of circular dependencies between modules
php bin/magento info:language:listphp bin/magento info:l:lDisplays the list of available language locales
php bin/magento info:timezone:listphp bin/magento info:t:lDisplays the list of available timezones
INVENTORY
php bin/magento inventory:reservation:create-compensationsphp bin/magento i:r:cCreate reservations by provided compensation arguments
php bin/magento inventory:reservation:list-inconsistenciesphp bin/magento i:r:lShow all orders and products with salable quantity inconsistencies
INVENTORY-GEONAMES
php bin/magento inventory-geonames:importphp bin/magento i:importDownload and import geo names for source selection algorithm
MAINTENANCE
php bin/magento maintenance:allow-ipsphp bin/magento main:aSets maintenance mode exempt IPs
php bin/magento maintenance:disablephp bin/magento main:dDisables maintenance mode
php bin/magento maintenance:enablephp bin/magento main:eEnables maintenance mode
php bin/magento maintenance:statusphp bin/magento main:uDisplays maintenance mode status
MODULE
php bin/magento module:config:statusphp bin/magento mo:c:sChecks the modules configuration in the ‘app/etc/config.php’ file and reports if they are up to date or not
php bin/magento module:disablephp bin/magento mo:dDisables specified modules
php bin/magento module:enablephp bin/magento mo:eEnables specified modules
php bin/magento module:statusphp bin/magento mo:sDisplays status of modules
php bin/magento module:uninstallphp bin/magento mo:uUninstalls modules installed by composer
MSP
php bin/magento msp:security:recaptcha:disablephp bin/magento m:s:r:dDisable backend reCaptcha
php bin/magento msp:security:tfa:disablephp bin/magento m:s:t:dGlobally disable two factor auth
php bin/magento msp:security:tfa:providersphp bin/magento m:s:t:pList all available providers
php bin/magento msp:security:tfa:resetphp bin/magento m:s:t:rReset configuration for one user
NEWRELIC
php bin/magento newrelic:create:deploy-markerphp bin/magento n:c:dCheck the deploy queue for entries and create an appropriate deploy marker.
QUEUE
php bin/magento queue:consumers:listphp bin/magento q:c:lList of MessageQueue consumers
php bin/magento queue:consumers:startphp bin/magento q:c:sStart MessageQueue consumer
SAMPLEDATA
php bin/magento sampledata:deployphp bin/magento s:deployDeploy sample data modules for composer-based Magento installations
php bin/magento sampledata:removephp bin/magento s:removeRemove all sample data packages from composer.json
php bin/magento sampledata:resetphp bin/magento s:resetReset all sample data modules for re-installation
SETUP
php bin/magento setup:backupphp bin/magento s:bTakes backup of Magento Application code base, media and database
php bin/magento setup:config:setphp bin/magento s:c:sCreates or modifies the deployment configuration
php bin/magento setup:cron:runphp bin/magento s:c:rRuns cron job scheduled for setup application
php bin/magento setup:db-data:upgradeInstalls and upgrades data in the DB
php bin/magento setup:db-declaration:generate-patchGenerate patch and put it in specific folder.
php bin/magento setup:db-declaration:generate-whitelistGenerate whitelist of tables and columns that are allowed to be edited by declaration installer
php bin/magento setup:db-schema:upgradeInstalls and upgrades the DB schema
php bin/magento setup:db:statusphp bin/magento s:d:sChecks if DB schema or data requires upgrade
php bin/magento setup:di:compilephp bin/magento s:d:iGenerates DI configuration and all missing classes that can be auto-generated
php bin/magento setup:installphp bin/magento s:iInstalls the Magento application
php bin/magento setup:performance:generate-fixturesphp bin/magento s:p:gGenerates fixtures
php bin/magento setup:rollbackphp bin/magento s:rRolls back Magento Application codebase, media and database
php bin/magento setup:static-content:deployphp bin/magento s:s:dDeploys static view files
php bin/magento setup:store-config:setphp bin/magento s:s:sInstalls the store configuration. Deprecated since 2.2.0. Use config:set instead
php bin/magento setup:uninstallphp bin/magento s:unUninstalls the Magento application
php bin/magento setup:upgradephp bin/magento s:upUpgrades the Magento application, DB data, and schema
STORE
php bin/magento store:listphp bin/magento s:lDisplays the list of stores
php bin/magento store:website:listphp bin/magento s:w:lDisplays the list of websites
THEME
php bin/magento theme:uninstallphp bin/magento t:uUninstalls theme
VARNISH
php bin/magento varnish:vcl:generatephp bin/magento v:v:gGenerates Varnish VCL and echos it to the command line
YOTPO
php bin/magento yotpo:resetphp bin/magento y:rReset Yotpo sync flags &/or configurations
php bin/magento yotpo:syncphp bin/magento y:sSync Yotpo manually (reviews module)
php bin/magento yotpo:update-metadataphp bin/magento y:uManually send platform metadata to Yotpo

You can follow officila Magentoi document here

I hope this post will save your time during development as moSt of all required commands posted here based on Magento 2.3.4. Please let me know if you find out any missed command. Happy to update this!!

Leave a Reply

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