Commands
This module provides a dedicated reference for every essential Restic command. Each guide covers syntax, key flags, practical examples, common pitfalls, and examples with output.
The Golden Rule
Always verify your backups. A backup is only a backup once you have successfully restored from it.
Learning-Path Lessons
These guides teach the core operational loop through grouped workflows:
| Lesson | Outcome |
|---|---|
| Initialization & Backup | Setup a repo and create your first snapshots |
| Navigation & Search | Find exactly what you need in your backup history |
| Integrity & Validation | Ensure your repository is healthy and catch growth trends |
| Retention & Cleanup | Automate the pruning of old data safely |
Command Reference
Setup and Inspection
| Command | What It Does |
|---|---|
| init | Initialize a new Restic repository |
| stats | Show storage totals and deduplication efficiency |
| version | Print version information |
Data Operations
| Command | What It Does |
|---|---|
| backup | Create a new snapshot of local data |
| restore | Extract files/directories from a snapshot |
| mount | Browse snapshots as a local filesystem (FUSE) |
Listing and Discovery
| Command | What It Does |
|---|---|
| snapshots | List all available restore points |
| ls | List files inside a specific snapshot |
| find | Search for specific files across snapshots |
| diff | Compare two snapshots to see what changed |
| cat | Print a file from a snapshot to stdout |
Maintenance and Cleanup
| Command | What It Does |
|---|---|
| check | Verify repository structural integrity and data |
| forget | Remove old snapshots according to retention rules |
| prune | Physically delete unreferenced data from storage |
| unlock | Remove stale lock files after crashed operations |
Quick Drill
Initialize a local repo and run your first backup in 30 seconds:
# Setup
export RESTIC_REPOSITORY="/tmp/restic-repo"
export RESTIC_PASSWORD="password"
# Execution
restic init
restic backup /etc --tag initial
restic snapshots