Home » Magento, Magento 214 April 2016

Magento 2: Command Line Tool / Interface (CLI)

Magento 2 uses Symfony’s Console Component for its command-line interface or tool (CLI) where we can execute different commands for different tasks related to installation and configuration.

Through the Command Line Interface (CLI) tool in Magento 2, you can perform different tasks like:

  • Installing Magento
  • Clearing the cache
  • Managing indexes, including reindexing
  • Creating translation dictionaries and translation packages
  • Generating non-existent classes such as factories and interceptors for plug-ins
  • Generating the dependency injection configuration for the object manager
  • Deploying static view files
  • Creating CSS from LESS

Read more: Introducing the Magento command-line interface (CLI)

Running/Executing Commands

  • Open terminal.
  • Go to your magento installation directory root.
  • Run the following command. Here we don’t pass any command or argument to the interface.
  • This will list all available installation and configuration commands.

Note: If it doesn’t work or shows error then you can run the command with sudo:

Or, you can also pass the list command to the ‘magento’ CLI to list all available commands:

You will get the following result when you run the above commands:

Magento CLI version 2.0.0

Usage:

Options:

Available commands:

admin (Command to create and unlock administrator)

cache (Command to enable, disable, clear, flush cache)

catalog (Command to resize product images)

cron (Command to run cron job)

customer (Command to upgrade customer’s hash)

deploy (Command to set and show deployment mode)

dev (Command to deploy theme and run tests)

i18n (Command to install and uninstall language packages)

indexer (Command to reindex and check indexer status)

info (Command to get different information about admin URI, framework dependency, module dependency, currency, backup, language and timezone)

maintenance (Command to enable/disable maintenance mode)

module (Command to enable/disable module)

sampledata (Command to install/uninstall sample data)

setup (Command install/uninstall/upgrade Magento)

theme (Command to uninstall theme)

Finding details about each command

To know about the arguments that can be passed to the above commands, we can use --help option to the command.

For example: To know about all arguments for creating admin user (admin:user:create) command, we can run the following command:

The output of above command will be:

Similarly, you can find details about all other commands.

Hope this helps. Thanks.

Magento 2

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • admin:user:create gives the error: admin:user:create: command not found