Knowledge Base

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 CLI enables you to run and automate common installation and configuration tasks from the command line.

About the Magento CLI

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.

Using the Magento CLI

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

More Information

For detailed information about the Magento CLI, please visit