restic(1)
A fast, secure, and efficient backup program that stores encrypted backups in local or remote repositories.
Synopsis
restic [GLOBAL_OPTIONS] <command> [COMMAND_OPTIONS]Description
Restic is a modern backup tool that creates encrypted, deduplicated backups of files and directories. It supports local storage as well as remote backends like S3, Azure, Google Cloud, and SFTP. All data is encrypted end-to-end, and restic can efficiently handle incremental backups with content-defined chunking.
Backups are organized as snapshots, allowing you to restore files from any point in time. Restic uses a REST API for remote access and includes built-in features for repository maintenance, integrity checking, and secure key management.
Common options
| Flag | What it does |
|---|---|
-r, --repo string | Repository location (local path or remote URL); can be set via RESTIC_REPOSITORY env var |
-p, --password-file string | Read password from file instead of prompting; alternatively use RESTIC_PASSWORD |
--json | Output results in JSON format for parsing by scripts |
-v, --verbose | Enable verbose output; repeat for more verbosity (-vv, -vvv) |
--no-lock | Skip repository locking (use with caution on local repos) |
-o, --option key=value | Pass backend-specific options (e.g., -o s3.storage-class=GLACIER) |
--cleanup-cache | Remove unused cache data after operation completion |
--limit-upload int | Limit upload bandwidth to kB/s (0 = unlimited) |
Examples
Initialize a new restic repository in /mnt/backup; prompts you to create a password
restic init -r /mnt/backupCreate a snapshot backing up two directories to a local repository
restic backup -r /mnt/backup /home/user/documents /home/user/photosBackup /data to AWS S3, excluding all .tmp files
restic backup -r s3:s3.amazonaws.com/my-bucket --exclude '*.tmp' /dataList all snapshots in the repository with timestamps and file counts
restic snapshots -r /mnt/backupRestore the most recent snapshot to /restore/path
restic restore -r /mnt/backup latest --target /restore/pathRestore a specific file or directory from snapshot 9c8c01c2
restic restore -r /mnt/backup 9c8c01c2 /path/in/backup --target /restore/pathRemove unreferenced data and optimize repository storage
restic prune -r /mnt/backupVerify repository integrity by reading and validating all backup data
restic check -r /mnt/backup --read-data