Skip to content

Running a custom Magento command ​

The buttons on your store's Maintenance tab cover the everyday maintenance actions. For anything else Magento's command line offers — clearing one specific cache, importing configuration, deploying static files for a single language — use Run a custom command on the same tab.

You type the part after bin/magento, for example:

cache:clean config full_page
indexer:reset
app:config:import
setup:static-content:deploy -f en_US

What can be run ​

A command is accepted when all three of these hold:

  1. It's a plain command. A command name plus its options and values — nothing else. Characters like ; | & $ ( ) < > and quotes aren't allowed, and the whole command must fit in 200 characters.
  2. It isn't on the blocked list. Commands that could destroy your store, change admin accounts, or switch the application mode aren't allowed (see below).
  3. Your store really offers it. We check the command against your store's own bin/magento list before running it — so commands added by your installed extensions work too, and a typo is caught rather than run.

Blocked commands ​

CommandWhy
setup:uninstall, setup:rollback, setup:backupDestructive — they can wipe or overwrite your store. Your store is already backed up automatically.
admin:user:create, admin:user:unlock, admin:user:deleteThey change who can sign in to your admin.
module:disable, module:uninstallUse the Extensions tab, which checks your store is still healthy afterwards and undoes the change if not.
deploy:mode:setYour store must stay in production mode.
config:sensitive:setCommands are logged, so secrets must never be typed on a command line. Set sensitive values in your Magento admin instead.

For a Magento version upgrade, use Update Magento on the Maintenance tab.

What happens when you run it ​

  • Your store is put into maintenance mode for the duration of the command, so shoppers never see it half-way through a change.
  • When the command finishes, your storefront is restarted so any code or configuration change takes effect.
  • Your store must then start up and answer normally. If it doesn't, the run is reported as failed.
  • If the command itself reports an error — even when your store stays healthy — the result says the command reported an error and shows the reason.

Only one maintenance action or command runs on a store at a time.

Seeing the output ​

The Last run line under the box shows the command and how it went. When a command reports an error, you can download its full output — it's kept for 24 hours.

Good to know ​

  • Prefer the buttons when one fits: they also handle the steps around the command for you (see Refreshing and rebuilding your store).
  • A custom command runs against your live store. If you're not sure what it will do, try it in a sandbox first.