Restoring Files With Borg
Reviewed in November 2026
The borg extract command restores a full archive or selected paths from it, including all metadata. It is the fastest way to restore a large number of files. If you would rather browse archives and copy a few files, see Mount and Browse Archives. For other options and what you need on a new machine, see the overview.
Prerequisites
Section titled “Prerequisites”You should already have Borg installed and know how to use the command line. If you haven’t installed Borg yet, have a look at the command line setup guide.
Step 1 – Listing the Archives
Section titled “Step 1 – Listing the Archives”To use borg extract, you need to know the precise path and archive name to restore. The borg list command lists all archives in a repository or, with an archive name appended, the files in that archive:
borg list ssh://w66xh7lj@w66xh7lj.repo.borgbase.com/./repoborg list ssh://w66xh7lj@w66xh7lj.repo.borgbase.com/./repo::nyx2-test-repo-2019-02-16T12:04:06Assuming we got the archive name and path from the previous step, a borg extract command looks like this:
borg extract \ --dry-run --list \ ssh://w66xh7lj@w66xh7lj.repo.borgbase.com/./repo::nyx2-test-repo-2019-02-16T12:04:06 \ /Users/manu/Documents/financialDue to the --dry-run and --list arguments, this prints a list of files to be restored without actually restoring any files. To restore the files, remove --dry-run.
The last part of the command gives the path you’re looking to restore. If you pass no paths, all data is restored. If you would like to extract a particular directory without its full path, add --strip-components n, with n being the number of leading directory components to strip.
Step 2 – Extracting the Archives
Section titled “Step 2 – Extracting the Archives”Borg restores your files to the current working directory, so be sure you are in the right place before running the command for real. Borg 2 only extracts into an empty directory unless you add --continue. To restore all data from a specific archive to the current directory:
borg extract \ --list \ ssh://w66xh7lj@w66xh7lj.repo.borgbase.com/./repo::nyx2-test-repo-2019-02-16T12:04:06For more information on extracting, check out the official Borg documentation.