$linuxjunkies
>

restic(1)

A fast, secure, and efficient backup program that stores encrypted backups in local or remote repositories.

UbuntuDebianFedoraArch

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

FlagWhat it does
-r, --repo stringRepository location (local path or remote URL); can be set via RESTIC_REPOSITORY env var
-p, --password-file stringRead password from file instead of prompting; alternatively use RESTIC_PASSWORD
--jsonOutput results in JSON format for parsing by scripts
-v, --verboseEnable verbose output; repeat for more verbosity (-vv, -vvv)
--no-lockSkip repository locking (use with caution on local repos)
-o, --option key=valuePass backend-specific options (e.g., -o s3.storage-class=GLACIER)
--cleanup-cacheRemove unused cache data after operation completion
--limit-upload intLimit 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/backup

Create a snapshot backing up two directories to a local repository

restic backup -r /mnt/backup /home/user/documents /home/user/photos

Backup /data to AWS S3, excluding all .tmp files

restic backup -r s3:s3.amazonaws.com/my-bucket --exclude '*.tmp' /data

List all snapshots in the repository with timestamps and file counts

restic snapshots -r /mnt/backup

Restore the most recent snapshot to /restore/path

restic restore -r /mnt/backup latest --target /restore/path

Restore a specific file or directory from snapshot 9c8c01c2

restic restore -r /mnt/backup 9c8c01c2 /path/in/backup --target /restore/path

Remove unreferenced data and optimize repository storage

restic prune -r /mnt/backup

Verify repository integrity by reading and validating all backup data

restic check -r /mnt/backup --read-data

Related commands