24

I need to know the list of useful commands for Magento 2 in short-cut form

Can anyone help me?

3

7 Answers 7

61

Setup upgrade:

php bin/magento s:up

Cache Flush:

php bin/magento c:f

Disable Cache:

php bin/magento c:d

Enable Cache:

​​​​​​php bin/magento c:e

Static Content Deploy:

php bin/magento s:s:d

Di Compile:

php bin/magento s:d:c

Var clean folder:

php bin/magento v:c

Uninstall Magento application:

php bin/magento s:un

Runs cron job scheduled for setup application:

php bin/magento s:c:r

Disables specified modules:

php bin/magento mo:d CompanyName_ModuleName

Enables specified modules:

php bin/magento mo:e CompanyName_ModuleName

Displays status of modules:

php bin/magento mo:s

Uninstalls modules installed by composer (which only installed by composer):

php bin/magento mo:u CompanyName_ModuleName

Cleans cache type(s):

php bin/magento c:c

Disables cache type(s):

php bin/magento c:d

Enables cache type(s):

php bin/magento c:e

Flushes cache storage used by cache type(s):

php bin/magento c:f

Checks cache status:

php bin/magento c:s

Enable Maintenance Mode Using Command Line:

php bin/magento ma:e

Disable Maintenance Mode Using Command Line:

php bin/magento ma:d

Shows allowed Indexers:

php bin/magento i:i

Reindexes Data:

php bin/magento i:rei

Resets indexer status to invalid:

php bin/magento i:res

Sets index mode type:

php bin/magento i:res

Shows status of Indexer:

php bin/magento i:st

For more : Reference

2
  • 7
    It's important to note that you or other packages can add additional commands, which may invalidate some of the above short commands. Short commands can be useful for fast typing, but never use them in a script. Apr 24, 2018 at 15:32
  • Thanks for sharing such a well prepared list.
    – Pupil
    Jan 12, 2021 at 4:34
25

Available commands:

php bin/magento  list                  php bin/magento l

admin

php bin/magento admin:user:create              php bin/magento a:u:c
php bin/magento admin:user:unlock              php bin/magento a:u:u   

cache

php bin/magento cache:clean                  php bin/magento c:c
php bin/magento cache:disable                php bin/magento c:d
php bin/magento cache:enable                 php bin/magento c:e
php bin/magento cache:flush                  php bin/magento c:f
php bin/magento cache:status                 php bin/magento c:s

catalog

php bin/magento catalog:images:resize                   php bin/magento c:i:r
php bin/magento catalog:product:attributes:cleanup      php bin/magento c:p:a:c

cron

php bin/magento cron:run              php bin/magento c:r

customer

php bin/magento customer:hash:upgrade     php bin/magento c:h:u

deploy

php bin/magento deploy:mode:set           php bin/magento d:m:se
php bin/magento deploy:mode:show          php bin/magento d:m:sh

dev

php bin/magento dev:source-theme:deploy        php bin/magento d:source-theme:d
php bin/magento dev:tests:run                  php bin/magento d:t:r
php bin/magento dev:urn-catalog:generate       php bin/magento d:urn-catalog:g
php bin/magento dev:xml:convert                php bin/magento d:x:c

i18n

php bin/magento i18n:collect-phrases           php bin/magento i:collect-phrases
php bin/magento i18n:pack                      php bin/magento i:p
php bin/magento i18n:uninstall                 php bin/magento i:u

indexer

php bin/magento indexer:info                   php bin/magento i:i
php bin/magento indexer:reindex                php bin/magento i:rei
php bin/magento indexer:reset                  php bin/magento i:res
php bin/magento indexer:set-mode               php bin/magento i:set
php bin/magento indexer:show-mode              php bin/magento i:show
php bin/magento indexer:status                 php bin/magento i:st

info

php bin/magento info:adminuri                              php bin/magento i:a
php bin/magento info:backups:list                          php bin/magento i:b:l
php bin/magento info:currency:list                         php bin/magento i:c:l
php bin/magento info:dependencies:show-framework           php bin/magento i:d:show-framework
php bin/magento info:dependencies:show-modules             php bin/magento i:d:show-modules
php bin/magento info:dependencies:show-modules-circular    php bin/magento i:d:show-circular
php bin/magento info:language:list                         php bin/magento i:l:l
php bin/magento info:timezone:list                         php bin/magento i:t:l

maintenance

php bin/magento maintenance:allow-ips          php bin/magento ma:a
php bin/magento maintenance:disable            php bin/magento ma:d
php bin/magento maintenance:enable             php bin/magento ma:e
php bin/magento maintenance:status             php bin/magento ma:s

module

php bin/magento module:disable                 php bin/magento mo:d
php bin/magento module:enable                  php bin/magento mo:e
php bin/magento module:status                  php bin/magento mo:s
php bin/magento module:uninstall               php bin/magento mo:u

sampledata

php bin/magento sampledata:deploy            php bin/magento ma:d
php bin/magento sampledata:remove            php bin/magento sa:rem
php bin/magento sampledata:reset             php bin/magento sa:res

setup

php bin/magento setup:backup                            php bin/magento se:b
php bin/magento setup:config:set                        php bin/magento se:c:se
php bin/magento setup:cron:run                          php bin/magento se:c:r
php bin/magento setup:db-data:upgrade                   php bin/magento se:db-data:u
php bin/magento setup:db-schema:upgrade                 php bin/magento se:db-schema:u
php bin/magento setup:db:status                         php bin/magento se:d:st
php bin/magento setup:di:compile                        php bin/magento se:d:c
php bin/magento setup:install                           php bin/magento se:i
php bin/magento setup:performance:generate-fixtures     php bin/magento se:p:generate-fixtures
php bin/magento setup:rollback                          php bin/magento se:r
php bin/magento setup:static-content:deploy             php bin/magento se:s:d
php bin/magento setup:store-config:set                  php bin/magento se:sto:s 
php bin/magento setup:uninstall                         php bin/magento se:un
php bin/magento setup:upgrade                           php bin/magento se:up

theme

php bin/magento theme:uninstall                         php bin/magento t:u

Source

3
  • 1
    Now I see a few commands are ambiguous (have more than one interpretation) like php bin/magento c:s . How ambiguous commands can be handled ?
    – amitshree
    Sep 12, 2018 at 12:29
  • 2
    @amitshree when you have same starting word then have to add second like int this c:st will do the trick Sep 12, 2018 at 12:40
  • 1
    That's nice :-)
    – amitshree
    Sep 13, 2018 at 6:08
8

I added some shortcuts command here.

1. Setup Upgrade Command Line

php bin/magento setup:upgrade ==> php bin/magento s:up

2. Cache Command Line

php bin/magento cache:clean ==> php bin/magento c:c

php bin/magento cache:disable ==> php bin/magento c:d

php bin/magento cache:enable [cache_type] ==> php bin/magento c:e [cache_type]

php bin/magento cache:flush [cache_type] ==> php bin/magento c:f [cache_type]

php bin/magento cache:status ==> php bin/magento c:s

3. Static Content Deploy Using Command Line

php bin/magento setup:static-content:deploy ==> php bin/magento s:s:d

4. Reindexing Using Command Line

php bin/magento indexer:reindex ==> php bin/magento i:rei

php bin/magento indexer:info ==> php bin/magento i:i

php bin/magento indexer:status ==> php bin/magento i:sta

php bin/magento indexer:show-mode ==> php bin/magento i:sho

php bin/magento indexer:reset ==> php bin/magento i:res

5. Modules Command Line

php bin/magento module:status ==> php bin/magento mo:s

php bin/magento module:disable Namespace_Module ==> php bin/magento mo:d

php bin/magento module:enable Namespace_Module ==> php bin/magento mo:e

php bin/magento module:uninstall Namespace_Module ==> php bin/magento m:u

A lot of shortcuts in Magento. Frequently used command only I have provided.

Hope it will helpful for other.

for more reference: https://github.com/brentwpeterson/magento-patches/wiki/Magento-CLI-shortcuts

4
4

Helpful shortcuts for bin/magento

enter image description here

3

List of magento 2 commands shortcut.

Setup Upgrade

php bin/magento s:up

If you don’t want to remove pub/static files while installing/updating database then use following command.

php bin/magento s:up --keep-generated

Cache Clean

php bin/magento c:c

Cache Flush

php bin/magento c:f

Disable Cache

php bin/magento c:d

Enable Cache

php bin/magento c:e

Reindexing

php bin/magento i:rei

View the list of indexers

php bin/magento i:i

View indexer status

php bin/magento i:st

View indexer Resets

php bin/magento i:res

Show the mode of all indexers

php bin/magento i:sh

Static Content Deploy

php bin/magento s:s:d

Static Content Deploy For Particular Language

php bin/magento s:s:d en_US

Static Content Deploy For Magento Backend theme

php bin/magento s:s:d --theme="Magento/backend"

Static Content Deploy For Specific Themes

php bin/magento s:s:d --theme Magento/luma --theme Magento/second_theme

Exclude Themes on Static Content Deploy and does not minify HTML

php bin/magento s:s:d en_US --exclude-theme Magento/luma --no-html-minify

Di Compile

php bin/magento s:d:c

See all modules Status

php bin/magento mo:s

Enable module

php bin/magento mo:e Namespace_Module

Disable module

php bin/magento mo:d Namespace_Module

Uninstall Module

php bin/magento mo:u Namespace_Module

Check Current Mode

php bin/magento d:m:sh

Change To Developer Mode

php bin/magento d:m:se developer

Change To Production Mode

php bin/magento d:m:se production

Hope it'll help you all.

2

You can see list of commands from below command.

php bin/magento

list of Shortcut commands key :

https://github.com/brentwpeterson/magento-patches/wiki/Magento-CLI-shortcuts

1
  • This command lists all the CLI commands but the question is for commands shortcuts. May 22, 2018 at 10:25
0

Just simply run the below command. It will display all the commands in the Magento.

php bin/magento     

      or

php bin/magento l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.