Magento 2 Command Line Tool (/bin/magento)

- Magento 2

Magento 2 CLI

Since Magento 2 provides a very useful implementation of Symfony’s Console component, you can easily perform tons of important actions from a command line interface. It is possible to reindex, clean cache, generate code, create database backups, and run other commands with the help of this instrument. Moreover, you can easily enhance the existing solution with your own commands aimed at your Magento 2 extensions. Below, I explain how to use Magento 2 CLI tool and what commands to run.

'

How to Run Magento 2 Command Line Tool from Magento 2 Root Folder

  php bin/magento

The following post contains a list of commands (magento help <command>) with all possible use cases and parameters. Such command groups as Admin do not have any extended info, as it doesn’t make sense, since a command displays some info itself and there are no parameters to be passed.

  vagrant@mage2:/vagrant/data/magento2/bin$ php magento

Magento CLI version 1.0.0-beta

Usage:

command [options] [arguments]

Options:

 

Available commands:

admin

cache

catalog

cron

dev

i18n

indexer

info

maintenance

module

setup

theme

Admin Magento 2 CLI commands

 admin:user:create

Creates a Magento administrator user account

Cache Magento 2 CLI commands

cache:status

With this command you can see a list of all Magento 2 caches, each of them can be used for such cache management commands as clean or disable.

cache:clean

Cleans Magento 2 cache by type or all cache complete.

 cache:disable

Disables Magento 2 specific cache types or all cache complete.

 cache:enable

Enable Magento 2 specific cache types or all cache complete

cache:flush

Flushes Magento 2 cache storage

Cron Magento 2 CLI commands

cron:run   

Runs specific cron job in Magento 2 system       

Developer Magento 2 CLI commands

dev:css:deploy

Collects, processes, and publishes source LESS files

dev:tests:run

Runs Magento 2 tests.

dev:xml:convert

Converts XML file using XSL style sheets

i18n Magento 2 CLI commands

i18n:collect-phrases

Discovers phrases in the codebase.

i18n:pack                 

Saves Magento 2 language package.

i18n:uninstall

Uninstalls language packages.

Indexer Magento 2 CLI Commands

indexer:info

Shows allowed Indexers – get each index names and use them to set mode and reindex.

indexer:reindex

 Reindexes Data

indexer:set-mode  

 Sets index mode type.

indexer:show-mode

 Shows Index Mode

indexer:status

 Shows status of Indexer, or –all Magento 2 indexers

Framework Magento 2 CLI Commands

info:dependencies:show-Magento 2 modules

 Shows number of dependencies between Magento 2 modules.

info:dependencies:show-Magento 2 modules-circular

 Shows number of circular dependencies between modules.

Maintenance Magento 2 CLI Commands

Sets maintenance mode exempt IPs.

maintenance:disable

 Disables maintenance mode.

maintenance:enable

 Enables maintenance mode.

maintenance:status

Displays maintenance mode status

Module Magento 2 CLI Commands

module:disable

 Disables specified Magento 2 modules.

module:enable

Enables specified Magento 2 modules.

module:status 

Displays status of Magento 2 modules.

module:uninstall

Uninstalls Magento 2 modules installed by composer.

Setup Magento 2 CLI Commands

setup:backup

Takes backup of Magento Application code base, media and database

setup:config:set

 Creates or modifies the deployment configuration of Magento 2

setup:cron:run

Runs cron job scheduled for setup application

To be continue..

We will keep updating this post as any changes and updates related to Magento 2 Command line tool interface are available.

More Magento 2 features, tips, and rumours

'