# Magento — Die bin/magento-Kommandozeile

> Praxis-Guide zur Magento-CLI bin/magento — Module, Cache, Indexer, Setup, Deployment und Wartung von Magento 2 / Adobe Commerce über die Kommandozeile steuern.

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

<!-- PROSE:intro -->
`bin/magento` ist das zentrale Kommandozeilen-Werkzeug von Magento 2 und Adobe Commerce – darüber steuerst du so gut wie jede administrative Aufgabe, vom Cache-Leeren über das Neuindizieren bis zum Setzen des Produktionsmodus. Statt im Backend zu klicken, erledigst du Module-Verwaltung, Schema-Upgrades und Deployments reproduzierbar im Terminal, ideal für Skripte und Deploy-Pipelines. Dieser Guide bündelt die Kommandos, die du im Alltag und beim Ausrollen am häufigsten brauchst.
<!-- PROSE:intro:end -->

## Allgemeines & Infos

`bin/magento list` — Listet alle verfügbaren Kommandos auf.

```bash
bin/magento list
```

`bin/magento help <command>` — Zeigt die Hilfe zu einem bestimmten Kommando.

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

`bin/magento info:adminuri` — Zeigt die URI des Admin-Bereichs an.

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

`bin/magento --version` — Zeigt die Magento-Version an.

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

## Setup & Deployment

`bin/magento setup:upgrade` — Führt Datenbank-Schema- und Daten-Upgrades aus.

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

`bin/magento setup:di:compile` — Kompiliert die Dependency-Injection-Konfiguration.

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

`bin/magento setup:static-content:deploy` — Stellt statische View-Dateien bereit.

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

`bin/magento setup:static-content:deploy <locales>` — Stellt statische Inhalte für bestimmte Sprachen bereit.

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

`bin/magento deploy:mode:show` — Zeigt den aktuellen Deployment-Modus an.

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

`bin/magento deploy:mode:set <mode>` — Setzt den Deployment-Modus (developer, production, default).

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

## Cache-Verwaltung

`bin/magento cache:status` — Zeigt die Cache-Typen und ihren Status an.

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

`bin/magento cache:flush` — Leert den gesamten von den Cache-Typen genutzten Cache-Speicher.

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

`bin/magento cache:clean` — Bereinigt bestimmte Cache-Typen.

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

`bin/magento cache:enable <type>` — Aktiviert einen Cache-Typ.

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

`bin/magento cache:disable <type>` — Deaktiviert einen Cache-Typ.

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

## Indexer

`bin/magento indexer:status` — Zeigt den Status der Indexer an.

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

`bin/magento indexer:reindex` — Indiziert alle Indexer neu.

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

`bin/magento indexer:reindex <indexer>` — Indiziert einen bestimmten Indexer neu.

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

`bin/magento indexer:info` — Zeigt alle verfügbaren Indexer an.

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

`bin/magento indexer:set-mode <mode>` — Setzt den Indexer-Modus (realtime oder schedule).

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

## Modul-Verwaltung

`bin/magento module:status` — Zeigt den Status aller Module an.

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

`bin/magento module:enable <module>` — Aktiviert ein Modul.

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

`bin/magento module:disable <module>` — Deaktiviert ein Modul.

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

`bin/magento module:uninstall <module>` — Deinstalliert ein Modul (entfernt Code und Daten).

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

## Wartung & Administration

`bin/magento maintenance:enable` — Aktiviert den Wartungsmodus.

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

`bin/magento maintenance:disable` — Deaktiviert den Wartungsmodus.

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

`bin/magento maintenance:status` — Zeigt den Status des Wartungsmodus an.

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

`bin/magento admin:user:create` — Legt einen neuen Admin-Benutzer an.

```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>` — Entsperrt ein Admin-Konto.

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

`bin/magento cron:run` — Führt geplante Cron-Jobs aus.

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

`bin/magento store:list` — Listet alle Stores und Store-Views auf.

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

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

Mit `bin/magento` hast du den gesamten Lebenszyklus eines Magento-2- oder Adobe-Commerce-Shops in der Hand, vom ersten Setup bis zum laufenden Betrieb. Geh dabei mit den eingreifenden Kommandos bewusst um: `setup:upgrade` ändert das Datenbank-Schema, lege also vorher ein Backup an; nach `setup:upgrade` und `setup:di:compile` ist meist ein `cache:flush` fällig, damit Änderungen greifen. Schalte vor Wartungsarbeiten den Wartungsmodus mit `maintenance:enable` ein und setze den Produktivbetrieb erst nach `deploy:mode:set production` plus erneutem Static-Content-Deploy live. So bleiben Upgrades und Deployments reproduzierbar und sicher.

## Weiterführende Links

- [Adobe Commerce CLI-Referenz](https://experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/cli/config-cli) – offizielle Übersicht der bin/magento-Kommandos (englisch)
- [Magento Open Source / Adobe Commerce für Entwickler](https://developer.adobe.com/commerce/) – offizielle Entwicklerdokumentation (englisch)
<!-- PROSE:outro:end -->

## Verwandte Kommandos

- [artisan](https://www.jpkc.com/db/cheatsheets/build-languages/artisan/) – die Kommandozeile von Laravel: Code generieren, Migrationen und Queues steuern
- [cargo](https://www.jpkc.com/db/cheatsheets/build-languages/cargo/) – Paketmanager und Build-Tool von Rust
- [composer](https://www.jpkc.com/db/cheatsheets/build-languages/composer/) – Dependency-Manager für PHP, mit dem auch Magento installiert wird

