magento-2
Development, Magento 2 Extensions

Magento 2 Useful Commands List 2023

Magento 2 is a powerful e-commerce platform that provides a flexible and scalable architecture for building custom online stores.

In this tutorial, we will show you the best useful command line for Magento 2.

Here are some of the most useful CLI commands for Magento 2:

Table of Contents

1) Clean Cache

php bin/magento cache:clean

2) Flush Cache

php bin/magento cache:flush

3) Disable Cache

php bin/magento cache:disable

4) Enable Cache

php bin/magento cache:enable

5) Check Cache Status

php bin/magento cache:status

6) Enable Module

php bin/magento module:enable Namespace_Module

7) Disable Module

php bin/magento module:disable Namespace_Module

8) Uninstall Module

php bin/magento module:uninstall Namespace_Module

9) Check Modules Status

php bin/magento module:status

10) Check Current Deploy Mode

php bin/magento deploy:mode:show

11) Enable Developer Mode

php bin/magento deploy:mode:set developer

12) Enable Production Mode

php bin/magento deploy:mode:set production

13) Static Content Deploy

php bin/magento setup:static-content:deploy

14) Static Content Deploy For Specific Language

php bin/magento setup:static-content:deploy en_GB

15) Static Content Deploy For Specific Themes

php bin/magento setup:static-content:deploy –theme Magento/luma –theme Magento/other_theme

16) Static Content Deploy For Backend Theme

php bin/magento setup:static-content:deploy –theme=”Magento/backend”

17) Static Content Deploy For Exclude Themes

php bin/magento setup:static-content:deploy –exclude-theme Vendor/yourtheme

18) Static Content Deploy For Particular Language(en_US), Exclude Themes, Not Minify HTML Files

php bin/magento setup:static-content:deploy –exclude-theme Vendor/yourtheme

19) ReIndex

php bin\magento indexer:reindex

20) Get List of Available Indexers

php bin/magento indexer:info

21) Check Indexer status

php bin/magento indexer:status

22) Check Status of Specific Indexer

php bin/magento indexer:status indexer_name

23) Reset All Indexer

php bin/magento indexer:reset

24) Show the Mode of All Indexers

php bin/magento indexer:show-mode

25) Check Mode of Specific Indexer

php bin/magento indexer:show-mode indexer_name

26) View Magento Version

php bin/magento –version

27) Uninstall Magento Theme

php bin/magento theme:uninstall

28) Uninstall Magento

php bin/magento setup:uninstall

29) Upgrades Magento Setup

php bin/magento setup:upgrade

30) Upgrades Magento Setup(Don’t want to Remove pub/static Files)

php bin/magento setup:upgrade –keep-generated

31) Backup of Magento Application(Code, Media, Database)

php bin/magento setup:backup

32) Backup of Magento Only Code

php bin/magento setup:backup –code

33) Backup of Magento Only Database

php bin/magento setup:backup –db

34) Backup of Magento Only Media

php bin/magento setup:backup –media

35) Magento Backup/Snapshot

php bin/magento setup:backup -v –code –media –db

Note: all of the backups will be stored in the var/backups

36) Get List of All Backups

php bin/magento info:backups:list

37) Restore/Rollback Magento 2 From Backups

php bin/magento setup:rollback [-c|–code-file=”<name>”][-m|–media-file=”<name>”][-d|–db-file=”<name>”

38) Restore/Rollback Magento 2 Code

php bin/magento setup:rollback -c 566566565_filesystem_code.tgz

39) Restore/Rollback Magento 2 Database

php bin/magento setup:rollback -d 767767676_db.sql

40) Restore/Rollback Magento 2 Media

php bin/magento setup:rollback -m 1470820565_filesystem_media.tgz

41) Enable Maintenance Mode

php bin/magento maintenance:enable

42) Disable Maintenance Mode

php bin/magento maintenance:disable

43) Enable Maintenance Mode For All Clients(IPs) Except

php bin/magento maintenance:enable –ip=192.0.2.10 –ip=192.0.2.11

44) Disable Maintenance Mode For All Clients(IPs) Except

php bin/magento maintenance:disable –ip=192.0.2.10 –ip=192.0.2.11

45) Show the Current Status of Maintenance Mode

php bin/magento maintenance:status

46) Exempt IP Addresses From Maintainance Mode

php bin/magento maintenance:allow-ips 192.168.1.10 192.168.1.11

47) Displays the Magento Admin URI

php bin/magento info:adminuri

48) Displays the List of Available Language Locales

php bin/magento info:language:list

49) Displays the List of Available Timezones

php bin/magento info:timezone:list

50) Displays the List of Available Currencies

php bin/magento info:currency:list

We hope this is useful for you 🙂

Posted by
Editorial Staff

Editorial Staff at WebShouters is a team of experts.

Leave a Reply

Your email address will not be published. Required fields are marked *