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,extractalways writes into the current working directory ("."), so make sure youcdto the right place before callingborg 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-idsinstead. bestie she's old, let her go π--numeric-idsβ only obey numeric user and group identifiers. names? never heard of her π’--nobsdflagsβ deprecated, use--noflagsinstead. 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
- alpine 3.24: borgbackup-doc 1.4.5-r0 Β· BSD-3-Clause
- arch rolling: borg 1.4.5-1 Β· BSD
- ubuntu stonking: borgbackup 1.4.5-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms