> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0lock.0flaw.fr/llms.txt
> Use this file to discover all available pages before exploring further.

# Référence CLI

> Toutes les commandes de `0lock` avec exemples.

La CLI **`0lock`** expose les mêmes garanties cryptographiques que la GUI. Les exemples ci-dessous illustrent les sorties attendues ; les détails peuvent varier selon la version exacte.

## Aide globale

```bash theme={null}
0lock --help
0lock --version
```

Sortie exemple :

```
0lock 0.9.0-beta (rustc 1.76) — aarch64-unknown-linux-gnu
```

***

## `0lock init`

Initialise un nouveau coffre vide sur disque.

```bash theme={null}
0lock init --path ~/Vaults/famille
```

```
✓ Coffre créé : ~/Vaults/famille/vault.db
  → Déverrouillez avec : 0lock unlock ~/Vaults/famille/vault.db
```

***

## `0lock unlock`

Prépare la session (variables d’environnement ou socket selon build).

```bash theme={null}
0lock unlock ~/Vaults/famille/vault.db
```

```
Mot de passe principal : ********
✓ Session ouverte — expire dans 45 min d'inactivité
```

***

## `0lock add`

Ajoute une entrée.

```bash theme={null}
0lock add login notion --url https://notion.so --user dev@entreprise.fr
```

```
✓ Entrée « notion » créée (id: ent_8k3…)
```

***

## `0lock get`

Affiche un champ (stdout adapté aux scripts).

```bash theme={null}
0lock get notion --field password --clipboard
```

```
• Copié dans le presse-papiers (effacement dans 30 s)
```

***

## `0lock list`

```bash theme={null}
0lock list --folder Travail
```

```
notion          login    Travail    maj il y a 2 j
aws-console     login    Travail    maj hier
wifi-invité     secure-note    Perso    maj le 01/03
```

***

## `0lock delete`

```bash theme={null}
0lock delete wifi-invité --confirm
```

```
✓ Entrée supprimée (corbeille désactivée en CLI — irréversible)
```

***

## `0lock gen`

```bash theme={null}
0lock gen --length 28 --symbols --count 3
```

```
xT9$mK2…qP7   (entropy ~ 164 bits)
Rb4&nV8…wZ2   (entropy ~ 164 bits)
Hc2!jL5…tY9   (entropy ~ 164 bits)
```

***

## `0lock audit`

```bash theme={null}
0lock audit --json
```

```
{
  "weak": 3,
  "reused": 1,
  "missing_2fa": 12,
  "hibp_hits": 0
}
```

***

## `0lock pwned`

Interrogation fuites (k-anonymité).

```bash theme={null}
0lock pwned --check notion
```

```
[!] Aucune fuite connue pour le mot de passe actuel de « notion »
```

***

## `0lock totp`

```bash theme={null}
0lock totp add aws-root --secret BASE32SECRET…
0lock totp show aws-root
```

```
482193   TTL 23s
```

***

## `0lock import` / `0lock export`

```bash theme={null}
0lock import csv ./export.csv --dry-run
0lock import csv ./export.csv

0lock export csv ./backup.csv
```

```
✓ Import terminé : 128 entrées créées, 4 ignorées (doublons)
✓ Export écrit : ./backup.csv (ATTENTION : fichiers en clair)
```

***

## `0lock sync`

```bash theme={null}
0lock sync push
0lock sync pull
0lock sync status
```

```
Synchronisation… upload 12 objets — download 0
✓ État : synchronisé (HEAD rev 9142)
```

***

## `0lock config`

```bash theme={null}
0lock config set clipboard_ttl_seconds 45
0lock config get clipboard_ttl_seconds
0lock config list
```

```
clipboard_ttl_seconds = 45
```

***

<CodeGroup>
  ```bash Thème shell theme={null}
  export ZEROLOCK_DEBUG=0  # désactivé par défaut
  0lock unlock ~/.0lock/vault.db && 0lock list
  ```

  ```powershell Windows theme={null}
  $env:CLIPBOARD_TTL="25"
  0lock unlock $HOME\.0lock\vault.db
  ```
</CodeGroup>

<Tip>
  Combinez avec `jq` pour traiter `0lock audit --json` dans vos pipelines CI internes (secrets fictifs uniquement).
</Tip>
