Some useful Magento 2 commands along with their functionalities

Magento 2 commands
Below useful Magento 2 commands , you’ll find the list of all important Magento 2 SSH / CLI commands that you’ll often need when working on a project. Magento 2

  1. Module Management:
    • Enable Module: bin/magento module:enable Vendor_Module – Enables a specific module.
    • Disable Module: bin/magento module:disable Vendor_Module – Disables a specific module.
    • List Modules: bin/magento module:status – Lists the status of all modules.
  2. Cache Management:
    • Flush Cache: bin/magento cache:flush – Flushes the cache storage.
    • Enable Cache: bin/magento cache:enable – Enables all caches.
    • Disable Cache: bin/magento cache:disable – Disables all caches.
  3. Index Management:
    • Reindex Data: bin/magento indexer:reindex – Reindexes data for all indexers.
    • List Indexers: bin/magento indexer:status – Displays the status of indexers.
    • Reset Indexer: bin/magento indexer:reset – Resets indexer(s) status to ‘Idle’.
  4. Database Management:
    • Upgrade Database Schema: bin/magento setup:upgrade – Upgrades the Magento database schema and data.
    • Deploy Static Content: bin/magento setup:static-content:deploy – Deploys static view files.
    • Rollback Database: bin/magento setup:rollback – Rolls back the Magento database to the previous version.
  5. Developer Tools:
    • Generate Module: bin/magento module:create Vendor_Module – Generates a new module.
    • Generate Controller: bin/magento generate:controller – Generates a controller class.
    • Generate Model: bin/magento generate:model – Generates a model class.
  6. Configuration:
    • Set Configuration Value: bin/magento config:set path/to/config value – Sets a configuration value.
    • View Configuration Value: bin/magento config:show path/to/config – Displays the value of a configuration setting.
    • Export Configuration: bin/magento config:export – Exports system configuration to a file.
  7. Testing and Debugging:
    • Run Tests: bin/magento dev:tests:run – Runs automated tests.
    • Generate Code Coverage Report: bin/magento dev:tests:run coverage – Generates a code coverage report for tests.

These commands cover a wide range of tasks, from basic management to advanced development and debugging. By mastering these commands, administrators and developers can efficiently manage and customize their Magento 2 stores

What do you think?

What to read next