Zoomtutorials
  • Cloud
    • Cloud Hosting
      • AWS
      • Azure
      • GCP
      • Oracle Cloud
      • Alibaba Cloud
      • IBM Cloud
      • DigitalOcean
      • Linode
  • DevOps
    • DevOps Tools
      • Terraform
      • Git
      • GitHub
      • Jenkins
      • Docker
      • Kubernetes
      • Ansible
      • Python
      • Monitoring
    • Azure DevOps
      • Azure Boards
      • Azure Repos
      • Azure Pipelines
      • Azure Test Plans
      • Azure Artifacts
      • Extensions Marketplace
    • AWS DevOps
      • CodeStar
      • CodeCommit
      • CodeBuild
      • CodeDeploy
      • CodePipeline
      • CodeArtifact
  • Programming
    • Application
      • Magento 2
      • Magento
      • WordPress
      • PHP
      • .Net
      • .Net Core
      • NodeJS
      • JAVA
    • Database
      • Microsoft SQL Server
      • MySQL
      • MariaDB
      • Amazon Aurora
      • SQL Proxy
    • Web Server
      • IIS
      • Apache
      • NGINX
      • Tomcat
      • NodeJS
    • Microsoft Dynamics ERP
      • Dynamics 365
        • D365 FnO
        • D365 BC
      • Dynamics AX
      • Dynamics NAV
      • Dynamics GP
      • Dynamics CRM
  • HowTos
    • Linux OS
      • RHEL
      • Ubuntu
      • CentOS
      • Fedora
      • Debian
    • Linux Tips
      • Linux Commands
      • Linux Tricks
      • Linux Cheatsheet
    • Windows OS
      • Server 2019
      • Server 2016
      • Server 2012
      • Server 2008
      • Windows 11
      • Windows 10
      • Windows 8
      • Windows 7
    • Windows Tips
      • Windows Commands
      • Windows Shortcuts
    • Microsoft
      • Office 365
      • Microsoft 365
      • SharePoint
      • MS Dynamics ERP
  • Tools
    • Monitoring
      • New Relic
      • ELK Stack
      • Loggly
      • DataDog
      • Papertrial
      • Graylog
      • UptimeRobot
    • Security
      • Firewall
      • Internet Security
      • Antivirus
    • Backup
      • SQL Backup
      • Iperius Backup
  • Hire Us
  • Courses
  • Submit Tutorials
  • More…
    • …
      • Services
      • News
      • Write For Us
      • Community
      • Donate ❤️
      • Contact Us
Facebook Twitter Instagram
Zoomtutorials
  • Cloud
    • Cloud Hosting
      • AWS
      • Azure
      • GCP
      • Oracle Cloud
      • Alibaba Cloud
      • IBM Cloud
      • DigitalOcean
      • Linode
  • DevOps
    • DevOps Tools
      • Terraform
      • Git
      • GitHub
      • Jenkins
      • Docker
      • Kubernetes
      • Ansible
      • Python
      • Monitoring
    • Azure DevOps
      • Azure Boards
      • Azure Repos
      • Azure Pipelines
      • Azure Test Plans
      • Azure Artifacts
      • Extensions Marketplace
    • AWS DevOps
      • CodeStar
      • CodeCommit
      • CodeBuild
      • CodeDeploy
      • CodePipeline
      • CodeArtifact
  • Programming
    • Application
      • Magento 2
      • Magento
      • WordPress
      • PHP
      • .Net
      • .Net Core
      • NodeJS
      • JAVA
    • Database
      • Microsoft SQL Server
      • MySQL
      • MariaDB
      • Amazon Aurora
      • SQL Proxy
    • Web Server
      • IIS
      • Apache
      • NGINX
      • Tomcat
      • NodeJS
    • Microsoft Dynamics ERP
      • Dynamics 365
        • D365 FnO
        • D365 BC
      • Dynamics AX
      • Dynamics NAV
      • Dynamics GP
      • Dynamics CRM
  • HowTos
    • Linux OS
      • RHEL
      • Ubuntu
      • CentOS
      • Fedora
      • Debian
    • Linux Tips
      • Linux Commands
      • Linux Tricks
      • Linux Cheatsheet
    • Windows OS
      • Server 2019
      • Server 2016
      • Server 2012
      • Server 2008
      • Windows 11
      • Windows 10
      • Windows 8
      • Windows 7
    • Windows Tips
      • Windows Commands
      • Windows Shortcuts
    • Microsoft
      • Office 365
      • Microsoft 365
      • SharePoint
      • MS Dynamics ERP
  • Tools
    • Monitoring
      • New Relic
      • ELK Stack
      • Loggly
      • DataDog
      • Papertrial
      • Graylog
      • UptimeRobot
    • Security
      • Firewall
      • Internet Security
      • Antivirus
    • Backup
      • SQL Backup
      • Iperius Backup
  • Hire Us
  • Courses
  • Submit Tutorials
  • More…
    • …
      • Services
      • News
      • Write For Us
      • Community
      • Donate ❤️
      • Contact Us
Facebook Twitter Instagram YouTube LinkedIn
Zoomtutorials
Magento 2

List of Useful Magento 2 Commands

ZT Senior EditorBy ZT Senior EditorAugust 18, 2021Updated:August 27, 2021No Comments6 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

Common Magento 2 Commands

Cache Clean:
php bin/magento cache:clean
Cache Flush:
php bin/magento cache:flush
Setup Upgrade:
php bin/magento setup:upgrade
If you want pub/static files while installing or updating database then use following command:
php bin/magento setup:upgrade --keep-generated
Setup Compile:
php bin/magento setup:di:compile
Static Content Deploy(use -f for force deploy on developer mode in 2.2.x or later):
php bin/magento setup:static-content:deploy
Static Content Deploy For Particular Language:
php bin/magento setup:static-content:deploy en_US
Static Content Deploy For Magento Backend Theme Using Command Line (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy --theme="Magento/backend"
Static Content Deploy For Specific Themes (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy --theme Magento/luma --theme Magento/another_theme
Exclude Themes on Static Content Deploy and does not minify HTML files Using Command Line (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy en_US --exclude-theme Magento/luma --no-html-minify
Reindex data:
php bin/magento indexer:reindex
View the list of indexers:
php bin/magento indexer:info
View indexer status:
php bin/magento indexer:status
Show the mode of all indexers:
php bin/magento indexer:show-mode

Here is the list of commands in Magento 2

Cache related commands:

  • Cache Clean: php bin/magento cache:clean
  • Cache Flush: php bin/magento cache:flush
  • View cache status: php bin/magento cache:status
  • Enable Cache: php bin/magento cache:enable [cache_type]
  • Disable Cache: php bin/magento cache:disable [cache_type]

Modes related commands:

  • Check Current Mode: 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

Module related commands:

  • See all modules Status: php bin/magento module:status
  • Enable module: php bin/magento module:enable Namespace_Module
  • Disable module: php bin/magento module:disable Namespace_Module
  • Uninstall Module: php bin/magento module:uninstall Namespace_Module

Site Maintenance Related Commands:

  • Enable Maintenance Mode: php bin/magento maintenance:enable
  • To enable maintenance mode for all clients except 10.10.16.1 and 10.10.16.2: php bin/magento maintenance:enable --ip=10.10.16.1 --ip=10.10.16.2
  • To clear the list of IPs: php bin/magento maintenance:enable --ip=none
  • Disable Maintenance Mode: php bin/magento maintenance:disable
  • Check Maintenance Mode: php bin/magento maintenance:status
  • Allow IP on Maintenance Mode: php bin/magento maintenance:allow-ips --ip=192.0.0.1 --ip=192.0.0.2

Other Commands:

  • Run the single-tenant Compiler: php bin/magento setup:di:compile
  • Unlock Admin User: php bin/magento admin:user:unlock adminusername
  • Set Magento crontab: php bin/magento cron:install --force Use --force to rewrite an existing Magento crontab.
  • To view the crontab, enter the following command as the Magento file system owner. crontab -l
  • Remove Magento crontab: php bin/magento cron:remove

Apart from the above, there are other Magento CLI which can be used to perform other functions. Below is a compilation of all the useful CLI commands for Magento 2. 

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 Magento2php 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

Thank you for reading. Happy a great day…!

magento 2 magento 2 commands
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Avatar photo
ZT Senior Editor
  • Website

The editor is the founder and chief editor of ZoomTutorials Blog, a leading tutorials and technology blogging site specializing in DevOps, SysAdmin and Cloud Technologies to help IT professionals in their day to day work. He is a Senior Cloud and DevOps Solutions Engineer at a leading eCommerce development Company and has more than 11+ years of Cloud, DevOps and SysAdmin experience working with Fortune 500 companies to solve their most important IT backbones. He lives in Hyderabad with his wife, a son and a daughter.

Related Posts

Magento 2 Commands and the Use Cases

August 18, 2021

Magento Community read/write splitting with Database Proxy

July 30, 2021

Leave A Reply Cancel Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Buy Me a Coffee Plz...

Get our latest tutorials
Recent Posts
  • Install Latest Git 2.x on CentOS/RHEL
  • How to Use the slmgr Command in Windows
  • How To Extend Windows Server Evaluation after Trial Period Expiry
  • List of Useful Magento 2 Commands
  • Magento 2 Commands and the Use Cases
  • MySQL and MariaDB Performance Tuning and Optimization
  • Microsoft Dynamics AX End of Support/Life
  • Magento Community read/write splitting with Database Proxy
  • Git Commands for developers and sysadmins
  • Install the git credential-oskeychain
December 2022
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Aug    
Archives
Facebook Twitter Instagram YouTube LinkedIn
  • Donation ❤️
  • About
  • Services
  • Submit Tutorials
  • Contact Us
  • Privacy Policy
  • Terms of Use
Copyright © 2023 by ZT Consulting. Designed with ❤️ by CloudSols.com. Hosting Partner Contabo.com. SSL Partner SSL.com. Monitoring Partner UptimeRobot.com

Type above and press Enter to search. Press Esc to cancel.