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.
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:
- Log in to your account using SSH.
- 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.
- Type the following command to make the CLI executable:
chmod 744 bin/magento
- 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:
For detailed information about all of the CLI’s options, please visit the official Magento documentation at http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli.html.
For detailed information about the Magento CLI, please visit http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli.html.