borg-extract(1)

✨ borg-extract(1) ✨

okay bestie, welcome to borg-extract πŸ’– this is the borg backup tool's "get my stuff back OUT of the archive" command and honestly? it's giving main character energy. it extracts archive contents. that's the whole vibe. let's go πŸŽ€


🌸 SYNOPSIS 🌸

borg [common options] extract [options] ARCHIVE [PATH...]

no cap, that's it. <italic>ARCHIVE</italic> and then optionally some paths, and she's ready πŸ¦‹


πŸ‘‘ DESCRIPTION πŸ‘‘

This command extracts the contents of an archive. periodt.

By default, the entire archive is extracted, but a subset of files and directories can be selected by passing a list of <italic>PATH</italic> arguments. The default interpretation for the paths to extract is pp: which is a literal path-prefix match. If you want to use e.g. a wildcard, you must select a different pattern style such as sh: or fm:. See borg_patterns for more information. (iykyk 🧚)

The file selection can be further restricted by using the --exclude option. For more help on include/exclude patterns, see the borg_patterns command output.

By using --dry-run, you can do all extraction steps except actually writing the output data: reading metadata and data chunks from the repository, checking the hash/HMAC, decrypting, and decompressing. so like, a full rehearsal, no files harmed πŸ’…

--progress can be slower than no progress display, since it makes one additional pass over the archive metadata. yeah bestie, sometimes the lil progress bar costs you 😭

Note: πŸ“Œ Currently, extract always writes into the current working directory ("."), so make sure you cd to the right place before calling borg extract. this is not a drill, she does NOT ask where to put things. When parent directories are not extracted (because of using file/directory selection or any other reason), Borg cannot restore parent directories' metadata, e.g., owner, group, permissions, etc. so those metadata vibes are simply lost to the void.

πŸ’… OPTIONS πŸ’…

See borg-common(1) for common options of Borg commands. (the shared lore, if you will 🫢)

πŸŽ€ arguments πŸŽ€

  • ARCHIVE β€” archive to extract. the one. the chosen one ✨
  • PATH β€” paths to extract; patterns are supported 🌈

πŸ“ options πŸ“

  • --list β€” output verbose list of items (files, dirs, ...). she's telling you everything she touches, love that for her πŸ‘€
  • -n, --dry-run β€” do not actually change any files. pure vibes, zero consequences πŸ™ˆ
  • --numeric-owner β€” deprecated, use --numeric-ids instead. bestie she's old, let her go πŸ’€
  • --numeric-ids β€” only obey numeric user and group identifiers. names? never heard of her πŸ”’
  • --nobsdflags β€” deprecated, use --noflags instead. retired icon, respect the legacy πŸŽ€
  • --noflags β€” do not extract/set flags (e.g. NODUMP, IMMUTABLE) 🚫
  • --noacls β€” do not extract/set ACLs 🚫
  • --noxattrs β€” do not extract/set xattrs 🚫
  • --stdout β€” write all extracted data to stdout. data goes straight to the screen/pipe, no files touched 🌊
  • --sparse β€” create holes in output sparse file from all-zero chunks. efficient queen πŸ‘‘

🌼 Include/Exclude options 🌼

  • -e PATTERN, --exclude PATTERN β€” exclude paths matching <italic>PATTERN</italic> 🚫
  • --exclude-from EXCLUDEFILE β€” read exclude patterns from <italic>EXCLUDEFILE</italic>, one per line πŸ“„
  • --pattern PATTERN β€” include/exclude paths matching <italic>PATTERN</italic> 🎯
  • --patterns-from PATTERNFILE β€” read include/exclude patterns from <italic>PATTERNFILE</italic>, one per line πŸ“„
  • --strip-components NUMBER β€” Remove the specified number of leading path elements. Paths with fewer elements will be silently skipped. note the "silently" β€” no drama, no warning, they just don't show up πŸ’€

πŸ”₯ EXAMPLES πŸ”₯

# Extract entire archive
$ borg extract /path/to/repo::my-files

# Extract entire archive and list files while processing
$ borg extract --list /path/to/repo::my-files

# Verify whether an archive could be successfully extracted, but do not write files to disk
$ borg extract --dry-run /path/to/repo::my-files

# Extract the "src" directory
$ borg extract /path/to/repo::my-files home/USERNAME/src

# Extract the "src" directory but exclude object files
$ borg extract /path/to/repo::my-files home/USERNAME/src --exclude '*.o'

# Extract only the C files
$ borg extract /path/to/repo::my-files 'sh:home/USERNAME/src/*.c'

# Restore a raw device (must not be active/in use/mounted at that time)
$ borg extract --stdout /path/to/repo::my-sdx | dd of=/dev/sdx bs=10M
okay that last one?? dd of=/dev/sdx?? that is a RAW DEVICE and it MUST NOT be active, in use, or mounted at that time. this is the final boss of "read the warning". do not freestyle this one bestie 😭

πŸ¦‹ SEE ALSO πŸ¦‹


🫢 Author 🫢

The Borg Collective πŸ‘‘


and that's the whole page, angel! written by the Borg Collective, and this lil manual page is dated 2026-07-18, straight from the borg-extract(1) source πŸ’œ slay, go get your files back 🌟

πŸ“¦ where this page comes from