LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

magento

command-line interface for Magento/Adobe Commerce e-commerce platform

TLDR

List available commands
$ bin/magento list
copy
Enable maintenance mode, allowing access from your IP
$ bin/magento maintenance:enable --ip=[203.0.113.10]
copy
Disable maintenance mode
$ bin/magento maintenance:disable
copy
Clean specific cache types
$ bin/magento cache:clean [config] [layout] [full_page]
copy
Flush all cache storage
$ bin/magento cache:flush
copy
Reindex all indexers
$ bin/magento indexer:reindex
copy
Show indexer status
$ bin/magento indexer:status
copy
Apply database schema and data upgrades after installing modules
$ bin/magento setup:upgrade
copy
Compile dependency injection
$ bin/magento setup:di:compile
copy
Deploy static content for specific locales
$ bin/magento setup:static-content:deploy -f [en_US] [de_DE]
copy
Switch to production mode
$ bin/magento deploy:mode:set production
copy
Show module status
$ bin/magento module:status
copy
Create an admin user
$ bin/magento admin:user:create --admin-user=[admin] --admin-password=[password] --admin-email=[admin@example.com] --admin-firstname=[First] --admin-lastname=[Last]
copy

SYNOPSIS

bin/magento command [options] [arguments]

DESCRIPTION

bin/magento is the command-line interface for the Magento Open Source and Adobe Commerce e-commerce platform. It is a Symfony Console application shipped in the bin/ directory of every Magento 2 installation and manages store operations, deployments, and maintenance tasks. Extensions can register additional commands.Cache management is critical for performance. Clean removes specific cached data while flush clears all storage. Different cache types (config, layout, block_html, collections, etc.) can be targeted individually.The deployment process involves dependency injection compilation, static content deployment, and database upgrades. These steps are required after code changes or module installations.Indexers keep derived data synchronized with source data. Reindexing is needed after catalog changes, price updates, or inventory modifications.Maintenance mode is toggled by the var/.maintenance.flag file and shows a service unavailable page to customers. IP addresses listed with --ip (stored in var/.maintenance.ip) can still reach the store.

PARAMETERS

cache:clean [TYPE...]

Clean enabled cache types (all if none given).
cache:flush [TYPE...]
Flush the cache storage, including entries not created by Magento.
cache:status
Show cache status.
cache:enable TYPE
Enable cache types.
cache:disable TYPE
Disable cache types.
indexer:reindex [INDEXER...]
Reindex all or the given indexers.
indexer:status
Show indexer status.
indexer:set-mode MODE [INDEXER...]
Set indexer mode (realtime or schedule).
maintenance:enable [--ip=IP]
Enable maintenance mode, optionally exempting IP addresses.
maintenance:disable
Disable maintenance mode.
setup:upgrade [--keep-generated]
Upgrade database schema and data after module changes.
setup:di:compile
Compile dependency injection.
setup:static-content:deploy [LOCALES] [-f] [--jobs=N]
Deploy static view files. -f forces deployment outside production mode.
module:status
List enabled and disabled modules.
module:enable MODULE
Enable module.
module:disable MODULE
Disable module.
deploy:mode:set MODE
Set application mode (default, developer, production).
deploy:mode:show
Show the current application mode.
cron:run
Run scheduled cron jobs.
config:set PATH VALUE
Set a configuration value.
admin:user:create
Create an administrator account.

CAVEATS

Commands are run as bin/magento from the Magento root directory (or php bin/magento); there is no global magento binary. Run them as the file system owner, not root, to avoid permission problems. Static content deployment takes time on large catalogs. Memory limits may need increasing for large stores.

HISTORY

Magento was released in 2008 by Varien, fully acquired by eBay in 2011, then spun off as an independent company in 2015. Adobe acquired Magento in 2018 and sells the commercial edition as Adobe Commerce. The bin/magento CLI was introduced with Magento 2 in 2015; Magento 1 reached end of life in June 2020.

SEE ALSO

composer(1), php(1), mysql(1), nginx(8)

RESOURCES

Copied to clipboard
Kai