10 – Magento learning – Day 10/30 – Magento commands Overview

Magento 2 provides a set of CLI (Command Line Interface) commands that you can use to perform various tasks, such as managing the application, installing modules, running tests, and more. Here is a list of commonly used Magento 2 CLI commands along with a brief description of their purpose:

General Commands:
bin/magento setup:upgrade
: Upgrades the Magento application, and applies database schema and data changes.
bin/magento setup:di:compile: Generates the DI (Dependency Injection) configuration files for faster performance.
bin/magento setup:static-content:deploy: Deploys static view files for the frontend and adminhtml areas.
bin/magento cache:flush: Flushes the cache storage, clearing all cached data.
bin/magento indexer:reindex: Rebuilds the index for catalog, search, and other indexed data.
bin/magento maintenance:enable: Enables maintenance mode, displaying a maintenance page to visitors.
bin/magento maintenance:disable: Disables maintenance mode.

Module-Related Commands:
bin/magento module:status: Lists the status of modules: enabled, disabled, or not found.
bin/magento module:enable: Enables a module.
bin/magento module:disable: Disables a module.
bin/magento module:uninstall: Uninstalls a module.
bin/magento module:config:status: Lists the configuration status of modules.

Database Commands:
bin/magento setup:backup: Creates a backup of the Magento application’s database and media files.
bin/magento setup:rollback: Rolls back the Magento application to a previous backup.
bin/magento setup:db-schema:upgrade: Upgrades the database schema.
bin/magento setup:db-data:upgrade: Upgrades the data in the database.
bin/magento setup:db:status: Checks if database schema or data requires upgrades.

Code Generation and Maintenance Commands:
bin/magento generate:module: Generates a new module.
bin/magento generate:controller: Generates a new controller in a module.
bin/magento generate:observer: Generates a new event observer in a module.
bin/magento dev:tests:run: Runs tests for a module or the entire Magento application.


These are just a few examples of the many CLI commands available in Magento 2.

You can explore more commands and their options by running bin/magento list or bin/magento –help.

Additionally, extensions and custom modules may provide their own CLI commands to perform specific tasks related to their functionality.