NOTMUCH-DUMP(1)
πΈ NAME πΈ
notmuch-dump β bestie, this makes a plain-text dump of the tags of each message πΎβ¨
π SYNOPSIS π
notmuch dump [--gzip] [--format=(batch-tag|sup)] [--output=<file>] [--]
[<search-term> ...]
π DESCRIPTION π
Okay so. This command dumps the tags for every message that matches the search terms you gave it. Slay.
Output goes to the filename you specified, if you specified one, or else it just goes to stdout. Simple as that.
Now listen, because this part is the whole point: these tags are the only data in the notmuch database that can't be recreated from the messages themselves. Like, everything else can be rebuilt, but the tags? Nope. So the output of notmuch dump is literally the only critical thing to back up β and it's also wayyy more friendly to incremental backup than the native database files. The vibe check here is: back this up, bestie, fr fr π«Ά
Peep notmuch-search-terms for all the deets on the supported syntax for <search-terms>. If you pass no search terms at all, you get a dump of every message in the database. And a -- argument tells notmuch that everything after it is a search term.
Supported options for dump include:
--gzipβ Compresses the output in a format that's compatible withgzip(1).--format=(sup|batch-tag)β Notmuch restore supports two plain text dump formats, and both of them have one message-id per line followed by a list of tags. Let's get into it:batch-tagβ This is the defaultbatch-tagdump format, and it's designed to be more robust against malformed message-ids and against tags containing whitespace ornon-ascii(7)characters. Every line looks like this:
+<encoded-tag> +<encoded-tag> ... -- id:<quoted-message-id>
Tags get hex-encoded by replacing every byte that doesn't match the regex [A-Za-z0-9@=.,_+-] with %nn, where nn is the two digit hex encoding. The message ID is a valid Xapian query, quoted using Xapian boolean term quoting rules: if the ID contains whitespace, or a close paren, or it starts with a double quote, then it has to be enclosed in double quotes β and any double quotes inside the ID must be doubled. The astute reader will notice that this is a special case of the batch input format for notmuch-tag; and heads up, the single message-id query is mandatory for notmuch-restore. π
supβ The sup dump file format is specifically chosen to be compatible with the format of files produced bysup-dump(1). So if you've been using sup for mail, thennotmuch-restoregives you a way to import all of your tags (or "labels", as sup calls them). Every line looks like this:
<message-id> ( <tag> ... )
with zero or more tags separated by spaces. Note that (malformed) message-ids may contain arbitrary non-null characters. Also note that tags with spaces will not be correctly restored with this format. π
--include=(config|properties|tags)β Controls what kind of metadata gets included in the output.configβ Outputs configuration data stored in the database. Each line starts with"#@ ", followed by a space separated key-value pair. Both the key and the value are hex encoded if needed.propertiesβ Outputs per-message(key,value)metadata. Each line starts with"#= ", followed by a message id, and a space separated list ofkey=valuepairs. Ids, keys and values are hex encoded if needed. Seenotmuch-propertiesfor more details.tagsβ Outputs per-message boolean metadata, namely tags. See the format above for the description of the output.
The default is to include all available types of data. You can specify this option multiple times to select some subset. And as of version 3 of the dump format, there's a header line that looks like this:
#notmuch-dump <format>:<version> <included>
where <included> is a comma separated list of the above options.
--output=<filename>β Writes output to the given file instead of stdout. β¨
π¦ SEE ALSO π¦
notmuch, notmuch-config, notmuch-count, notmuch-hooks, notmuch-insert, notmuch-new, notmuch-properties, notmuch-reply, notmuch-restore, notmuch-search, notmuch-search-terms, notmuch-show, notmuch-tag
π Author π
Carl Worth and many others
π Copyright π
2009-2026, Carl Worth and many others
And that's the whole page, bestie β this one's from notmuch version 0.40, dated Jan 31, 2026. Go back up your tags, you icon, you. π
πΈβ¨
π¦ where this page comes from
- fedora 44: notmuch 0.40-1.fc44 Β· GPL-3.0-or-later
- fedora 44: notmuch 0.40-1.fc44 Β· GPL-3.0-or-later
- nixos 26.05: notmuch 0.40
- ubuntu resolute: notmuch 0.40-1ubuntu1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms