• DevOps
    Case Study

    How we built a resilient multi-account, multi-cloud solution for a Health Tech service provider!

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How we built a scalable Odoo solution for a Travel Tech service provider!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    How we built a scalable Odoo solution for TravelTech service provider!

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us

Connect with us!


LinkedInFacebookXInstagramYouTube

aws partneraws advanced partner
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy
Introduction to Magento2 Command Line Interface (CLI)

Introduction to Magento2 Command Line Interface (CLI)

Afsal

  • 5 min read
Introduction to Magento2 Command Line Interface (CLI)

Generating audio, please wait...

Magento2 is the latest version of Magento, a CMS for e-commerce websites. It is significantly different from the previous Magento 1.x editions. Magento2 Command Line Interface is quite useful in performing various operations such as installations and configuration tasks.

It can be accessed from the PHP file ‘<magento root>/bin/magento’. This single PHP file can be used to perform a variety of tasks on your Magento.
Magento2

Magento CLI

Use the following command to list all the available commands for magento-cli.

php magento list

 

The output would look like the below image

Magento2

Magento Cache

Use the following commands to perform operations on Magento cache.

php magento cache:status # To view the current status of all cache types, i.e, 1 for enabled and 0 for disabled types.
php magento cache:enable [type] # To enable a cache type.
php magento cache:disable [type] # To disable a cache type.
php magento cache:clean [type] ... [type] # To clean a cache type.
php magento cache:flush [type] ... [type] # To flush a cache type.</code>

 

Magento2

Magento2

Magento2

Cleaning the cache deletes all items from the enabled cache types only.

Flushing the cache purges the cache storage.

If you do not specify type[s], it will clean/flush every cache types.

Indexer

Use the following commands to perform operations on Magento indexer.


php magento indexer:info # To view the list of indexers.

php magento indexer:status [indexer] # To view the current status of an indexer.

php magento indexer:reindex [indexer] # To reindex an indexer.

Magento2

Magento2

Magento2

Omit [indexer] to perform operation on all the indexers.

The Magento 2 indexer has 2 modes, 'realtime' and 'schedule'.

  • Realtime ( updated on save) : Indexed data is updated as soon as the change is made in the Admin panel.
  • Schedule ( update by schedule ) : Data is indexed according to a schedule set by your Magento cron.

Use the following command to view the current configuration.


php magento indexer:show-mode [indexer]

Magento2

To change mode,  use the following command.


php magento indexer:set-mode {realtime|schedule} [indexer]

Magento2

Code Compiler

To compile Magento code, use the following command if Magento has one website and store.


php magento setup:di:compile

For Magento with multiple stores and websites , i.e, more than one independent Magento applications.


php magento setup:di:compile-multi-tenant

Magento2

Maintenance Mode

Use the following command to enable maintenance mode


php magento maintenance:enable

You can also use the following commands to exempt IP addresses from maintenance mode. Users with the exempt IP addresses will get the normal website.


php magento maintenance:enable [--ip=<ip address> ... --ip=<ip address>]

or


php magento maintenance:allow-ips [<ip address> .. <ip address>] | [--none]

Use –none to clear the list.

Magento2

Modules

You can use the following commands to configure modules from CLI.

 

php module:uninstall <module name> # For uninstalling Modules
php module:status # For viewing the enabled and disabled modules
php module:disable <module name> # For disabling a module
php module:enable <module name> # For enabling a module  

 

Magento2

Magento2

Magento2

Magento2

You can use ‘ php magento module:disable –all ‘ to disable all modules and ‘ php magento module:enable –all ‘ to enable all modules.

Get 24/7 expert server management

References
http://devdocs.magento.com/guides/v2.0/install-gde/install-roadmap_cli.html
http://devdocs.magento.com/guides/v2.0/config-guide/bk-config-guide.html

  • Linux
  • magento

How to Redirect Visitors based on IP Location

How to Redirect Visitors based on IP Location
  • Linux
logo

Magento2: Configuration File

Magento2: Configuration File
  • Linux
  • magento
logo

PHP script to Change MySQL Table Prefix

PHP script to Change MySQL Table Prefix
  • Howtos
  • Linux
  • magento
  • MySQL
  • WordPress
logo

Steps to enable TLSv1.2 for PayPal /Stripe connections

Steps to enable TLSv1.2 for PayPal /Stripe connections
  • Howtos
  • Linux
  • Troubleshooting
logo

Posts by Afsal

Afsal is a tech enthusiast who is always ready to learn new technologies and explore new territories. Although his current focus revolves around the System Administration world, his never ending passion for technologies always keeps him active in other areas as well. He is currently working as a Systems Engineer at SupportSages.