Skip to content

Instantly share code, notes, and snippets.

@henri
Last active May 8, 2025 00:32
Show Gist options
  • Save henri/a2ad48bf2dcb148d4ad1e46af9ef742d to your computer and use it in GitHub Desktop.
Save henri/a2ad48bf2dcb148d4ad1e46af9ef742d to your computer and use it in GitHub Desktop.
restic cheatsheet (specific to fish shell)
# initilise restic backup repository + generate an initial key
restic init -r <repository-directory>
# configure enviroemnt varables (fish) / alter as needed
set -x RESTIC_REPOSITORY /path/to/repository
set -x RESTIC_PASSWORD_FILE /path/to/.restic_password
set -x RESTIC_PASSWORD my_AmZiNiNg_password
set -x RESTIC_EXCLUDE_FILE /path/to/.restic_exclude
# run a backup to the repository
restic backup <backup-source-file-or-directory>
# show snapshots
restic snapshots
# show top level items from latest snapshot
restic ls (restic snapshots --json | jq 'sort_by(.time) | .[-1]' | grep '"id": ' | tr -d , | tr -d \" | awk '{print $2}') | grep -E "^/"
# another approach is to tag a snapshot and then list it via that tag...
# prune snapshot data
restic prune
# check the repository
restic check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment