borg-list(1)
π¦ NAME π¦
borg-list β literally the List archive contents command, bestie. Yes, this is borg-list(1), the manual page you're reading rn, and by the end of it you're gonna be listing archives like it's nothing. π
β¨ SYNOPSIS β¨
borg [common options] list [options] NAME [PATH...]
πΈ DESCRIPTION πΈ
Okay so real talk: this command lists the contents of an archive. That's it. That's the gig. It reaches into an archive and shows you what's inside, like opening a little lunchbox but the lunchbox is a deduplicated chunk store. π
For more help on include/exclude patterns, see the output of borg_patterns β they got a whole separate situation for that, iykyk.
π OPTIONS π
See borg-common(1) for common options of Borg commands. (Every Borg command shares those, so don't @ me about them here.)
π arguments
NAMEβ specify the archive name π«ΆPATHβ paths to list; patterns are supported
π options
--shortβ only print file/directory names, nothing else. Minimalist queen behavior.--format FORMATβ specify format for file listing (default:"{mode} {user:6} {group:6} {size:8} {mtime} {path}{extra}{NL}")--json-linesβ Format output as JSON Lines. The form of--formatis ignored, but keys used in it are added to the JSON output. Some keys are always present. Note: JSON can only represent text.--depth Nβ only list files up to the specified directory depth--sort-by SPECβ sort output by comma-separated fields (e.g.'>size,path'), see Sorting below π
π Include/Exclude options
-e PATTERN,--exclude PATTERNβ exclude paths matchingPATTERN--exclude-from EXCLUDEFILEβ read exclude patterns fromEXCLUDEFILE, one per line--pattern PATTERNβ include/exclude paths matchingPATTERN--patterns-from PATTERNFILEβ read include/exclude patterns fromPATTERNFILE, one per line
π₯ EXAMPLES π₯
The classic. Just yeet the archive name in there:
$ borg list root-2016-02-15
drwxr-xr-x root root 0 Mon, 2016-02-15 17:44:27 +0100 .
drwxrwxr-x root root 0 Mon, 2016-02-15 19:04:49 +0100 bin
-rwxr-xr-x root root 1029624 Thu, 2014-11-13 00:08:51 +0100 bin/bash
lrwxrwxrwx root root 6 Fri, 2015-03-27 20:24:26 +0100 bin/bzcmp -> bzdiff
-rwxr-xr-x root root 2140 Fri, 2015-03-27 20:24:22 +0100 bin/bzdiff
...
Now let's gatekeep with a pattern π
$ borg list root-2016-02-15 --pattern "- bin/ba*"
drwxr-xr-x root root 0 Mon, 2016-02-15 17:44:27 +0100 .
drwxrwxr-x root root 0 Mon, 2016-02-15 19:04:49 +0100 bin
lrwxrwxrwx root root 6 Fri, 2015-03-27 20:24:26 +0100 bin/bzcmp -> bzdiff
-rwxr-xr-x root root 2140 Fri, 2015-03-27 20:24:22 +0100 bin/bzdiff
...
Custom --format, because the default fit was cute but we want β¨aestheticβ¨:
$ borg list archiveA --format="{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{NEWLINE}"
drwxrwxr-x user user 0 2015-02-01T11:00:00.000000+01:00 .
drwxrwxr-x user user 0 2015-02-01T11:00:00.000000+01:00 code
drwxrwxr-x user user 0 2015-02-01T11:00:00.000000+01:00 code/myproject
-rw-rw-r-- user user 1416192 2015-02-01T11:00:00.000000+01:00 code/myproject/file.ext
-rw-rw-r-- user user 1416192 2015-02-01T11:00:00.000000+01:00 code/myproject/file.text
...
Regex include + exclude-everything-else combo. Watch the \. β it matters, no cap:
$ borg list archiveA --pattern '+ re:\.ext$' --pattern '- re:^.*$'
-rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 +0100 code/myproject/file.ext
...
And the same vibe but without the escaping, so . matches any char and file.text sneaks in too:
$ borg list archiveA --pattern '+ re:.ext$' --pattern '- re:^.*$'
-rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 +0100 code/myproject/file.ext
-rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 +0100 code/myproject/file.text
...
Sorting time, bestie π
# Use --sort-by with a comma-separated list; sorts apply stably from last to first.
# Here: primary by size descending, tie-breaker by path ascending.
# Note the quoting - ">" would otherwise be a shell redirection.
$ borg list archiveA --sort-by='>size,path' --format='{size:8d} {path}{NL}'
1416192 code/myproject/file.ext
1416192 code/myproject/file.text
0 .
...
π NOTES π
π The FORMAT specifier syntax
The --format option uses Python's format string syntax <https://docs.python.org/3.11/library/string.html#formatstrings>. It's giving f-strings but in Borg. Obsessed.
Examples:
$ borg list --format '{mode} {user:6} {group:6} {size:8} {mtime} {path}{extra}{NL}' ArchiveFoo
-rw-rw-r-- user user 1024 Thu, 2021-12-09 10:22:17 file-foo
...
# {VAR:<NUMBER} - pad to NUMBER columns left-aligned.
# {VAR:>NUMBER} - pad to NUMBER columns right-aligned.
$ borg list --format '{mode} {user:>6} {group:>6} {size:<8} {mtime} {path}{extra}{NL}' ArchiveFoo
-rw-rw-r-- user user 1024 Thu, 2021-12-09 10:22:17 file-foo
...
The following keys are always available:
NEWLINE: OS dependent line separatorNL: alias ofNEWLINENUL: NUL character for creating print0 / xargs -0 like outputSPACE: space characterTAB: tab characterCR: carriage return characterLF: line feed character
Keys available only when listing files in an archive:
type: file type (file, dir, symlink, ...)mode: file mode (as in stat)uid: user id of file ownergid: group id of file owneruser: user name of file ownergroup: group name of file ownerpath: file pathtarget: link target for symlinkshlid: hard link identity (same if hardlinking same fs object)inode: inode numberflags: file flagssize: file sizenum_chunks: number of chunks in this filemtime: file modification timectime: file change timeatime: file access timeisomtime: file modification time (ISO 8601 format)isoctime: file change time (ISO 8601 format)isoatime: file access time (ISO 8601 format)fingerprint: Fingerprint of the file content (may have false negatives), format:H(conditions)-H(chunk_ids)blake2bblake2sblake3md5sha1sha224sha256sha384sha3_224sha3_256sha3_384sha3_512sha512archiveid: internal ID of the archivearchivename: name of the archiveextra: prepends{target}with" -> "for soft links and" link to "for hard links
π Sorting
Use --sort-by SPEC where SPEC is a comma-separated list of fields. Sorts are applied stably from last to first in the given list, thus the first field is the primary sort criterion. Prepend ">" for descending, "<" (or no prefix) for ascending order, e.g. --sort-by='>size,path' (quote it, ">" is a shell redirection).
π¨ bestie please quote that > β the shell will absolutely try to redirect if you don't, and then you'll have a bad time.
Supported fields, sorting by the same value that --format would print:
path: the item pathtype,mode: the file type character resp. the full file mode stringuser,group: the owner/group name, or the numeric id if the name is not knownuid,gid: the numeric owner/group idsize: the file size (same as{size}, 0 for items without content)mtime,ctime,atime: the timestamps (atime/ctime fall back to mtime if not stored)
There is no birthtime field, as there is no {birthtime} format key either. (If you were about to ask β no. π)
The sort fields are independent of --format, you may sort by a field you do not print.
π Note:--sort-byneeds to read all (matching) items into memory before it can print anything, so listing a huge archive this way needs a lot of memory and delays the first output line. Without--sort-by, items are streamed and their order is undefined. If memory usage is a problem, considerborg list --format ... | sortinstead.
π SEE ALSO π
borg-common(1), borg-info(1), borg-diff(1), borg-prune(1), borg-patterns(1), borg-repo-list(1)
π«Ά Author π«Ά
The Borg Collective
okay that's the whole page!! this was borg backup tool, borg-list(1), dated 2026-10-07 β slay, go list something, and remember: quote your > πβ¨ππ¦
π¦ where this page comes from
- ubuntu stonking: borgbackup2 2.0.0b25-4 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms