Get started with command-line configuration

Before you configure the Magento application

Before you begin, make sure that:

  1. Your system meets the requirements discussed in Magento System Requirements
  2. You completed all prerequisite tasks discussed in Prerequisites.
  3. After you log in to the Magento server, switch to a user that has permissions to write to the Magento file system. One way to do this is discussed in switch to the Magento file system owner.

First steps

  1. Log in to the Magento server as, or switch to, the Magento file system owner.
  2. Change to the following directory:

    1
    
    cd <magento_root>/bin
    

    Examples:

    • Ubuntu: cd /var/www/magento2/bin
    • CentOS: cd /var/www/html/magento2/bin

You can run the commands in any of the following ways:

  • php magento <command>
  • ./magento <command>
  • magento <command> (after adding <magento_root>/bin to your system PATH)

Command summary

The following table summarizes some of the available commands. Commands are shown in summary form only; for more information about a command, click the link in the Command column.

Before you run any of these commands, you must either install the Magento application or enable some modules.

Command Description
magento cache:{enable/disable/clean/flush/status} Manages the cache
magento indexer:{status/show-mode/set-mode/reindex/info/reset/show-dimensions-mode/set-dimensions-mode} Manages the indexers
magento cron:run Runs Magento cron jobs
magento setup:di:compile Compiles all non-existent proxies and factories; and pre-compiles class definitions, inheritance information, and plug-in definitions for one store and website.
magento info:dependencies:{show-modules/show-modules-circular/show-framework} Module dependencies, circular dependencies, and Magento framework dependencies.
magento i18n:{collect-phrases/pack/uninstall} Creates a translation dictionary or a translation package
magento setup:static-content:deploy Deploys static view files
magento dev:source-theme:deploy Creates CSS from LESS
magento dev:tests:run Runs automated tests
magento dev:xml:convert Update your layout XML files to match the new Extensible Stylesheet Language Transformations (XSLT) stylesheet
magento setup:perf:generate-fixtures Generate data to use for performance testing.
magento sampledata:install Installs optional Magento sample data after you install the Magento application.

For more details about Magento sample data, see Optional Magento sample data.
magento config:{set/sensitive:set/show/} Manages backend configurations
bin/magento admin:user:{create/unlock} Creates/edits/unlocks admin users.
bin/magento dev:template-hints:{enable/disable} Enables/disables developer template hints.

Help commands

To display a complete list of commands, enter:

1
magento list

To get help for a particular command, enter:

1
magento help <command>

For example,

1
magento help setup:install
1
magento help cache:enable

Common arguments

The following arguments are common to all commands. These commands can be run either before or after the Magento software is installed:

Long version Short version Meaning
--help -h Get help for any command. For example, ./magento help setup:install or ./magento help setup:config:set.
--quiet -q Quiet mode; no output.
--no-interaction -n No interactive questions.
--verbose=1,2,3 -v, -vv, -vvv Verbosity level. For example, --verbose=3 or -vvv displays debug verbosity, which is the most verbose output. Default is --verbose=1 or -v.
--version -V Display this application version
--ansi n/a Force ANSI output
--no-ansi n/a Disable ANSI output