MU-LABELS(1)
π MU-LABELS(1) β the manual, but make it cute π
okay bestie, sit down, hydrate, and let's talk about mu-labels, aka the mu sub-command that says "this message deserves a little name tag" π. This lil guy lives in the General Commands Manual for the mu mail indexer, and it's literally the labels plug-in you didn't know you needed.
β¨ NAME β¨
mu-labels β attach labels to messages. Export labels to file, and import them.
πΈ SYNOPSIS πΈ
mu [COMMON-OPTIONS] labels update [UPDATE-OPTIONS] "<query>" --labels [{+,-}<label>]...
mu [COMMON-OPTIONS] labels list
mu [COMMON-OPTIONS] labels list-restore
mu [COMMON-OPTIONS] labels clear [CLEAR-OPTIONS] "<query>"
mu [COMMON-OPTIONS] labels export [<file>]
mu [COMMON-OPTIONS] labels import <file>
π DESCRIPTION π
mu labels is the sub-command for adding and removing and listing message labels. no cap.
A label is a string associated with a message. that's it. that's the whole vibe. π¦
mu labels has six sub-commands (i.e., 'sub-sub-commands'). say that three times fast:
updatefor changing the labels for the messages matching some queryclearfor clearing all labels from messages matching some querylistto list all labels that are used in the storelist-restoreto restore the list of labels from the database (store)exportto write the label information to a fileimportthe read label information from a file
Important, bestie, listen to me: unlike other message metadata stored by mu, labels cannot be restored by merely re-indexing messages, since the information is not part of the message files. Hence, to avoid loosing label information, you mustexportit before re-indexing, andimportafterwards. π¨ Do NOT skip this step, I am begging. π
π₯ UPDATE OPTIONS π₯
The update command changes the labels for messages that match some query. The query must be recognized as a single parameter; hence, it must be quoted when using from a shell.
--labelsβ a comma-separated list of labels, each prefixed with either+to add that label, or-to remove it. See VALID LABELS.
mu4e users: note the difference, in mu4e the label expressions are space-separated, here they are comma-separated. β οΈ yes fr fr, read it twice. it's giving "easy to mess up".
--dry-runβ only print what would change, but do not change anything. window shopping only, no purchases. ποΈ--muhomeβ Use a non-default directory to store and read the database, write the logs, etc. By default,muuses the XDG Base Directory Specification (e.g. on GNU/Linux this defaults to~/.cache/muand~/.config/mu). Earlier versions ofmudefaulted to~/.mu, which now requires--muhome=~/.mu.
The environment variable MUHOME can be used as an alternative to --muhome. The latter has precedence. π
π§ CLEAR OPTIONS π§
The clear command removes all labels from messages that match some query. As with update, the query must be recognized as a single parameter, i.e., quote it when using a shell.
--dry-runβ only print what would change, but do not change anything. π--muhomeβ Use a non-default directory to store and read the database, write the logs, etc. By default,muuses the XDG Base Directory Specification (e.g. on GNU/Linux this defaults to~/.cache/muand~/.config/mu). Earlier versions ofmudefaulted to~/.mu, which now requires--muhome=~/.mu.
The environment variable MUHOME can be used as an alternative to --muhome. The latter has precedence. π
π LIST OPTIONS π
The list command lists all the labels that are currently in use in the store. This is the information is used for auto-completion in mu4e. β¨ autocomplete is iconic, honestly.
With the (global, directly after mu) --verbose option, this also includes the counts. π’
π«Ά LIST-RESTORE OPTIONS π«Ά
It is possible that the list of labels (as per the list sub-command) gets outdated for various reasons. With list-restore, this list get refreshed with the actual labels as seen in the store. it's the glow-up/resync moment. π¦
π¦ EXPORT OPTIONS π¦
The export command takes the labels in the store and the messages they apply to, and writes this information to a file. You can import this file later, to restore the labels. The command takes a path to a file or a directory (ending in /) as its argument.
- If a file is specified,
muwrites the export to it. - If a directory is specified,
muwrites to a file in that directory. The directory must already exist. (don't make it make the dir, it will not π) - When neither is specified,
muwrites to a file in the current directory.
See EXPORT FORMAT below for details about the format.
π IMPORT OPTIONS π
The import command is for restoring the labels from a file created through export earlier. The command takes a path to a file as its argument.
See EXPORT FORMAT below for details on the format.
--dry-runβ only print what would change, but do not change anything. π--muhomeβ Use a non-default directory to store and read the database, write the logs, etc. By default,muuses the XDG Base Directory Specification (e.g. on GNU/Linux this defaults to~/.cache/muand~/.config/mu). Earlier versions ofmudefaulted to~/.mu, which now requires--muhome=~/.mu.
The environment variable MUHOME can be used as an alternative to --muhome. The latter has precedence. π
π VALID LABELS π
mu does not wish to limit your creativity, but nevertheless puts a few restrictions on what is accepted as a label. it's not a hater, it just has boundaries. π
- a valid label character is any character that is not a control-character, not a blank, nor anything matching the regular expression
[^ - a valid label consists of one or more valid label characters, the first of which must not be either
+or-
Hence, some valid labels are: project-x, c@pybara, fnπrb, while some invalid ones are: holiday plan and +fancy$/dinner.
π EXPORT FORMAT π
The formats for import/export are text encoded as UTF-8. The first line starts with ;; and some internal data. Empty lines are ignored.
Each entry represents the labels for a message. Messages without labels are not included. (if you have no labels, you're simply not in the group chat π)
An entry consists of three lines:
- The first line starts with
path:followed by the file-system path to the message. - The second line starts with
message-id:followed by the message-id for the message. - Finally, the third line starts with
labels:followed by a comma-separated list of labels for the message
path:/home/user/Maildir/inbox/cur/1720645394.99f64f5d81f42ba4.hyperion:2,S
message-id:669338009127192q7821feh1t826d0c4c90bd8fdf@mail.gmail.com
labels:foo,bar,cuux
π Import using message-id π
The message-id: line is only used if the message cannot be found using path:.
This helps for the case where the precise file-system are not precisely the same as those used when exporting. This happens, for instance, when changes were made to the message flags since the export. Or when trying to import on a different machine with different paths.
In any case, when using the message-id for importing, any duplicate messages (messages with the same message-id), all get the same labels. no favorites, everyone gets the same sticker. β
π EXIT CODE π
This command returns 0 upon successful completion, or a non-zero exit code otherwise.
0β success π2β no matches found. Try a different query11β database schema mismatch. You need to re-initializemu, seemu-init(1)19β failed to acquire lock. Some other program has exclusive access to themudatabase99β caught an exception
β EXAMPLES β
Some examples. For the query parameter, make sure to quote the query to ensure it is recognized as a single parameter. quoting is your bestie here, periodt.
Remove the label "planet" and add the label "dwarf-planet" to all messages that have "pluto" in their subject:
$ mu labels update "subject:pluto" --labels -planet,+dwarf-planet
Clear all labels from messages with the label "boring":
$ mu labels clear "label:boring"
π REPORTING BUGS π
Please report bugs at https://github.com/djcb/mu/issues.
πΈ AUTHOR πΈ
Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
π COPYRIGHT π
This manpage is part of mu 1.14.2.
Copyright Β© 2008-2026 Dirk-Jan C. Binnema. License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
π¦ SEE ALSO π¦
mu-query(1)mu-find(1)
okay that's the whole thing!! you're now officially fluent in mu-labels, go label your mail like the main character you are π β that was MU LABELS(1), from the General Commands Manual, shipped with mu 1.14.2, and yes the copyright still says 2008-2026, we love a long-running icon. byeeeee πβ¨π
π¦ where this page comes from
- ubuntu stonking: maildir-utils 1.14.2-1 Β· 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