How to use the Magento command-line interface (CLI)

This article discusses the new command-line interface (CLI) tool in Magento 2.0. The Magento command-line interface enables you to run and automate common installation and configuration tasks from the command line.



Magento 2.0 introduces a new command-line interface (CLI). The CLI enables you to do many common installation and configuration tasks from the command line, including:

  • Managing the cache.
  • Managing catalogs.
  • Managing indexes.
  • Installing and upgrading the database schema.
  • Enabling and disabling maintenance mode.
  • Managing modules.
  • Managing translations.

Because the CLI is run from the command line, you can automate these tasks in shell script files or cron jobs.



To configure and run the Magento CLI, follow these steps:

  1. Log in to your account using SSH.
  2. At the command prompt, change to the directory where Magento is installed. For example, if Magento is installed in the document root directory, type
    cd ~/public_html.
  3. Type the following command to make the CLI executable:
    chmod 744 bin/magento
  4. To run the CLI and view the available command options, type the following command:

    The CLI has many command options. For example, to flush the caches, type the following command:

    bin/magento cache:flush

    For detailed information about all of the CLI’s options, please visit the official Magento documentation at



For detailed information about the Magento CLI, please visit


Hey! Don’t forget to visit LitExtension Blog for more shopping cart migration tutorials!

In case you have any other questions, please reach out to us via:

How can we help?