# Magento — The bin/magento Command Line

> Practical guide to the Magento CLI bin/magento — manage modules, cache, indexers, setup, deployment and maintenance for Magento 2 / Adobe Commerce.

Source: https://www.jpkc.com/db/en/cheatsheets/build-languages/magento/

<!-- PROSE:intro -->
`bin/magento` is the central command-line tool for Magento 2 and Adobe Commerce – it drives almost every administrative task, from flushing the cache and reindexing to switching into production mode. Instead of clicking through the backend, you handle module management, schema upgrades and deployments reproducibly from the terminal, which is ideal for scripts and deploy pipelines. This guide collects the commands you reach for most often in day-to-day work and during rollouts.
<!-- PROSE:intro:end -->

## General & Info

`bin/magento list` — List all available commands.

```bash
bin/magento list
```

`bin/magento help <command>` — Show help for a specific command.

```bash
bin/magento help setup:upgrade
```

`bin/magento info:adminuri` — Show the admin panel URI.

```bash
bin/magento info:adminuri
```

`bin/magento --version` — Show the Magento version.

```bash
bin/magento --version
```

## Setup & Deploy

`bin/magento setup:upgrade` — Run database schema and data upgrades.

```bash
bin/magento setup:upgrade
```

`bin/magento setup:di:compile` — Compile dependency injection configuration.

```bash
bin/magento setup:di:compile
```

`bin/magento setup:static-content:deploy` — Deploy static view files.

```bash
bin/magento setup:static-content:deploy -f
```

`bin/magento setup:static-content:deploy <locales>` — Deploy static content for specific locales.

```bash
bin/magento setup:static-content:deploy en_US de_DE
```

`bin/magento deploy:mode:show` — Show the current deployment mode.

```bash
bin/magento deploy:mode:show
```

`bin/magento deploy:mode:set <mode>` — Set deployment mode (developer, production, default).

```bash
bin/magento deploy:mode:set production
```

## Cache Management

`bin/magento cache:status` — Show cache types and their status.

```bash
bin/magento cache:status
```

`bin/magento cache:flush` — Flush all cache storage used by cache types.

```bash
bin/magento cache:flush
```

`bin/magento cache:clean` — Clean specific cache types.

```bash
bin/magento cache:clean config full_page
```

`bin/magento cache:enable <type>` — Enable a cache type.

```bash
bin/magento cache:enable full_page
```

`bin/magento cache:disable <type>` — Disable a cache type.

```bash
bin/magento cache:disable full_page
```

## Indexer

`bin/magento indexer:status` — Show indexer status.

```bash
bin/magento indexer:status
```

`bin/magento indexer:reindex` — Reindex all indexers.

```bash
bin/magento indexer:reindex
```

`bin/magento indexer:reindex <indexer>` — Reindex a specific indexer.

```bash
bin/magento indexer:reindex catalog_product_price
```

`bin/magento indexer:info` — Show all available indexers.

```bash
bin/magento indexer:info
```

`bin/magento indexer:set-mode <mode>` — Set indexer mode (realtime or schedule).

```bash
bin/magento indexer:set-mode schedule
```

## Module Management

`bin/magento module:status` — Show status of all modules.

```bash
bin/magento module:status
```

`bin/magento module:enable <module>` — Enable a module.

```bash
bin/magento module:enable Vendor_Module
```

`bin/magento module:disable <module>` — Disable a module.

```bash
bin/magento module:disable Magento_TwoFactorAuth
```

`bin/magento module:uninstall <module>` — Uninstall a module (removes code and data).

```bash
bin/magento module:uninstall Vendor_Module
```

## Maintenance & Admin

`bin/magento maintenance:enable` — Enable maintenance mode.

```bash
bin/magento maintenance:enable --ip=10.0.0.1
```

`bin/magento maintenance:disable` — Disable maintenance mode.

```bash
bin/magento maintenance:disable
```

`bin/magento maintenance:status` — Show maintenance mode status.

```bash
bin/magento maintenance:status
```

`bin/magento admin:user:create` — Create a new admin user.

```bash
bin/magento admin:user:create --admin-user=admin --admin-password=Admin123 --admin-email=admin@example.com --admin-firstname=Admin --admin-lastname=User
```

`bin/magento admin:user:unlock <user>` — Unlock an admin account.

```bash
bin/magento admin:user:unlock admin
```

`bin/magento cron:run` — Run scheduled cron jobs.

```bash
bin/magento cron:run
```

`bin/magento store:list` — List all stores and store views.

```bash
bin/magento store:list
```

<!-- PROSE:outro -->
## Conclusion

With `bin/magento` you hold the entire lifecycle of a Magento 2 or Adobe Commerce store in your hands, from the first setup to ongoing operations. Treat the invasive commands with care: `setup:upgrade` alters the database schema, so back up first; after `setup:upgrade` and `setup:di:compile` you usually need a `cache:flush` for changes to take effect. Switch on maintenance mode with `maintenance:enable` before maintenance work, and only go live in production after `deploy:mode:set production` plus a fresh static-content deploy. That keeps upgrades and deployments reproducible and safe.

## Further Reading

- [Adobe Commerce CLI reference](https://experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/cli/config-cli) – official overview of the bin/magento commands
- [Magento Open Source / Adobe Commerce for developers](https://developer.adobe.com/commerce/) – official developer documentation
<!-- PROSE:outro:end -->

## Related Commands

- [artisan](https://www.jpkc.com/db/en/cheatsheets/build-languages/artisan/) – Laravel's command line: generate code, run migrations and manage queues
- [cargo](https://www.jpkc.com/db/en/cheatsheets/build-languages/cargo/) – Rust's package manager and build tool
- [composer](https://www.jpkc.com/db/en/cheatsheets/build-languages/composer/) – dependency manager for PHP, also used to install Magento

