brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: restic find shows which snapshots contain a file

Backup
~/tips/tip-backup-restic-find

restic find "*.txt"

Searches the snapshots of a restic repository for files that match a pattern.

Finding the one snapshot that still has a file that was deleted by accident is a guessing game. restic find does the searching.

restic find "*.txt"
restic find --snapshot latest file1.txt

Without --snapshot, restic looks in all snapshots. You can narrow that down with --host, --path or --tag, and --snapshot can be repeated. To limit by date, --oldest and --newest filter on the modification time of the inode, for example --oldest 2025-01-01.

The caveat is in the docs: every positional argument is treated as a pattern, and names with spaces need quotes.

Once you know the snapshot and the path, restic restore --include or restic dump gets the file back.

I’d start without any filter on a small repository, and add --host or --path once the list gets long. For debugging there are also --blob, tree and pack file searches, but the docs say those are mainly for that purpose. Add --json if a script should read the result.

Two more options help with big result lists: --ignore-case makes the pattern match without regard to upper and lower case, and --long prints a long listing with size and mode for every match, which makes it easier to tell the copies of a file apart.

restic find --ignore-case --long "*.txt"

Further reading: restic: working with repositories

More Backup tips restic snapshots --group-by host,paths mysqldump --routines --events mydb > mydb.sql rsync -a --files-from=list.txt /home/me/ backup:/backup/ restic stats tmutil verifychecksums /path/to/backup-item All Backup tips (45) All topics

Link