Magento 2, a powerful and feature-rich e-commerce platform, offers a wide range of command-line tools to streamline development processes. In this article, we’ll explore the essential Magento 2 commands and how they can enhance your efficiency as a developer.
Please note that you need to run these commands from the Magento root directory using the specified command format (e.g., php bin/magento command_name
).
- Most Used Commands.
php bin/magento s:up && php bin/magento s:di:compile &&
php bin/magento s:s:d -f && php bin/magento c:f
- Installs Magento 2 with specified configuration options.
php bin/magento setup:install
- Clears the cache storage.
php bin/magento cache:clean
- Displays the status of installed modules.
php bin/magento module:status
- Upgrades the Magento 2 instance.
php bin/magento setup:upgrade
- Reindexes all Magento 2 indexes.
php bin/magento indexer:reindex
- Flushes the cache storage.
php bin/magento cache:flush
- Disables specified modules.
php bin/magento module:disable
- Deploys static view files for a specific theme.
php bin/magento dev:source-theme:deploy
- Enables maintenance mode for the Magento 2 store.
php bin/magento maintenance:enable
- Disables specified cache types.
php bin/magento cache:disable
- Creates an admin user.
php bin/magento admin:user:create
- Disables maintenance mode.
php bin/magento maintenance:disable
- Enables specified modules.
php bin/magento module:enable
- Displays the status of Magento 2 indexes.
php bin/magento indexer:status
- Runs cron jobs for Magento 2.
php bin/magento cron:run
- Sets the deployment mode for Magento 2.
php bin/magento deploy:mode:set
- Enables specified cache types.
php bin/magento cache:enable
- Generates classes for dependency injection.
php bin/magento setup:di:compile
- Imports configuration settings.
php bin/magento app:config:import
- Creates a customer account.
php bin/magento customer:create
- Sets the index mode for specific indexers.
php bin/magento indexer:set-mode
- Resets indexer status and cleans up indexer-related tables.
php bin/magento indexer:reset
- Unlocks the admin user account.
php bin/magento admin:user:unlock
- Displays the status of maintenance mode.
php bin/magento maintenance:status
- Displays information about specific indexes.
php bin/magento indexer:info
- Runs tests for Magento 2.
php bin/magento dev:tests:run
- Deletes a customer account.
php bin/magento customer:delete
- Removes cron job schedules.
php bin/magento cron:remove
- Resizes product images for specific store views.
php bin/magento catalog:images:resize
- Changes the password for an admin user.
php bin/magento admin:user:change-password
- Uninstalls specified modules.
php bin/magento module:uninstall
- Enables specified cache types.
php bin/magento cache:enable
- Rolls back Magento 2 installation or a specific module to a previous state.
php bin/magento setup:rollback
- Shows the current deployment mode.
php bin/magento deploy:mode:show
- Reindexes all Magento 2 indexes.
php bin/magento indexer:reindex:all
- Disables all cache types.
php bin/magento cache:disable
- Uninstalls Magento 2 completely.
php bin/magento setup:uninstall
- Installs Magento 2 cron job schedule.
php bin/magento cron:install
- Upgrades the database schema for Magento 2.
php bin/magento setup:db-schema:upgrade
- Lists only enabled modules.
php bin/magento module:status --enabled
- Reindexes catalog product prices.
php bin/magento indexer:reindex:catalog_product_price
- Cleans the configuration cache.
php bin/magento cache:clean config
- Enables all installed modules.
php bin/magento module:enable --all
- Reindexes the catalog search fulltext.
php bin/magento indexer:reindex catalogsearch_fulltext
- Enables the configuration cache.
php bin/magento cache:enable config
- Disables all installed modules.
php bin/magento module:disable --all
- Reindexes the catalog URL rewrites.
php bin/magento indexer:reindex catalog_url
- Enables the layout cache.
php bin/magento cache:enable layout
- Reindexes catalog category-product associations.
php bin/magento indexer:reindex catalog_category_product
- Enables the block HTML output cache.
php bin/magento cache:enable block_html
For more – Adobe Commerce
Thank you for reading my Article! Feel free to share your thoughts or ask any questions in the comments section below and spread the word by sharing. Your engagement is appreciated!