Magento 2 CLI Commands with syntax and description

Magento 2 CLI Command format:

Syntax:

> php <your Magento install dir>/bin/magento <command name>

Magento 2 CLI Command for module status. To see the status of module enable or disable:

> php bin/magento module:status

Magento 2 CLI Command to enable the module:

php bin/magento module:enable { Extension-Name }
i.e. php bin/magento module:enable Coddu_HelloWorld

Magento 2 CLI Command for clear cache:

php bin/magento cache:clean

Magento 2 CLI Command for clear cache flush:

> php bin/magento cache:flush

Magento 2 CLI Command for upgrade or Magento 2 CLI Command for upgrade module/extension:

> php bin/magento setup:upgrade

Magento 2 CLI Command for reindex url (Magento 2 indexing):

> php bin/magento index:reindex

Magento 2 CLI Command for compile or Magento 2 command for generate classes:

> php bin/magento setup:di:compile

Magento 2 CLI Command for static content deploy:

Syntax:

bin/magento setup:static-content:deploy [<languages>] [-t|--theme[="<theme>
"]] [--exclude-theme[="<theme>"]] [-l|--language[="<language>"]] [--exclude-language[="<language>"]] [-a|--area[="
<area>"]] [--exclude-area[="
<area>"]] [-j|--jobs[="<number>"]] [--no-javascript] [--no-css] [--no-less] [--no-images] [--no-fonts] [--no-html] [--no-misc] [--no-html-minify] [-d|--dry-run]

Example:

> php bin/magento setup:static-content:deploy -f

Magento 2 CLI Command to set up the mode:

There are three types of a mode in Magento 2.
1. Production
2. Develop
3. Default

To switch from one Magento 2 mode to another, it is easy to update via CLI Command.

Magento 2 CLI Command to show active/enabled mode:

> php bin/magento deploy:mode:show

Magento 2 CLI Command for set the mode:

> php bin/magento deploy:mode:set {mode} [-s|--skip-compilation]

Magento 2 CLI Command for developer mode:

> php bin/magento deploy:mode:set developer

Magento 2 CLI Command for production mode:

> php bin/magento deploy:mode:set production

Magento 2 CLI Command for default mode:

> php bin/magento deploy:mode:set default