Magento CLI: Complete List of Magento 2 Commands
Magento 2 provides a powerful Command-Line Interface (CLI) that allows developers and administrators to efficiently manage their store. This guide covers all available commands, including caching, indexing, deployment, database setup, and more.
Magento CLI: Introduction
With Magento CLI, you can perform various administrative tasks directly from the command line. Some of the most used commands include:
- Cache Management
- Indexing
- Deployment
- Maintenance Mode
- Module and Theme Management
- Database Setup & Upgrades
Additionally, you can create custom Magento CLI commands to extend the system’s functionality.
Magento CLI: List of Available Commands
Below is the complete list of Magento 2 CLI commands, categorized by functionality.
Magento CLI: General Commands
php bin/magento help
– Displays help for a command.php bin/magento list
– Lists all available commands.
Magento CLI: Admin Commands
php bin/magento admin:user:create
– Creates an admin user.php bin/magento admin:user:unlock
– Unlocks an admin account.
Magento CLI: Cache Management
php bin/magento cache:clean
– Cleans cache type(s).php bin/magento cache:disable
– Disables cache type(s).php bin/magento cache:enable
– Enables cache type(s).php bin/magento cache:flush
– Flushes the entire cache storage.php bin/magento cache:status
– Checks cache status.
Magento CLI: Indexer Commands
php bin/magento indexer:info
– Displays available indexers.php bin/magento indexer:reindex
– Reindexes data.php bin/magento indexer:reset
– Resets indexer status.php bin/magento indexer:show-mode
– Shows current index mode.php bin/magento indexer:status
– Displays indexer status.
Magento CLI: Setup & Configuration
php bin/magento setup:install
– Installs Magento.php bin/magento setup:upgrade
– Upgrades Magento database & modules.php bin/magento setup:db-schema:upgrade
– Upgrades database schema.php bin/magento setup:db-data:upgrade
– Upgrades database data.php bin/magento setup:di:compile
– Generates Dependency Injection (DI) configuration.php bin/magento setup:static-content:deploy
– Deploys static content files.
Magento CLI: Module Management
php bin/magento module:enable
– Enables modules.php bin/magento module:disable
– Disables modules.php bin/magento module:status
– Displays module statuses.php bin/magento module:uninstall
– Uninstalls modules installed via Composer.
Magento CLI: Maintenance Mode
php bin/magento maintenance:enable
– Enables maintenance mode.php bin/magento maintenance:disable
– Disables maintenance mode.php bin/magento maintenance:status
– Checks maintenance status.
Magento CLI: Theme Management
php bin/magento theme:uninstall
– Uninstalls a theme.
Magento CLI: Customer Management
php bin/magento customer:hash:upgrade
– Upgrades customer password hashing algorithm.
Magento CLI: Cron Jobs
php bin/magento cron:run
– Runs scheduled jobs.
Magento CLI: Developer Commands
php bin/magento dev:source-theme:deploy
– Collects and publishes theme source files.php bin/magento dev:tests:run
– Runs automated tests.php bin/magento dev:xml:convert
– Converts XML file using XSLT.
Magento CLI: Conclusion
Magento CLI provides a robust command-line interface to manage all aspects of your store efficiently. Mastering these commands can help streamline development, troubleshooting, and maintenance tasks.