Here are some tips for using
mu. If you want to know more, please refer to the
mu man pages. For a quick warm-up, there’s also the
$ mu index
mu did not guess the right Maildir, you can set it explicitly:
$ mu index --maildir=~/MyMaildir
If you want to exclude certain directories from being indexed (for example,
directories with spam-messages), put a file called
.noindex in the directory
to exlude, and it will be ignored when indexing (including its children)
After you have indexed your messages, you can search them. Here are some
examples. Also note the
--threads argument to get a threaded display of
the messages, and
--color to get colors (both since 0.9.7).
$ mu find Helsinki
$ mu find to:Jack subject:jellyfish tumbleweed
$ mu find size:2k..2m date:20091201..20093112 flag:attach from:bill
$ mu find flag:signed apples OR oranges
$ mu find maildir:'/Sent Items' yoghurt
$ mu find 'subject:soc*' flag:unread
Note, the ‘*’ only works at the end of a search term, and you need to
quote it or the shell will interpret it before
mu sees it.
(searching using the ‘*’ wildcard is available since mu 0.9.6)
$ mu find 'mime:image/*'
(since mu version 0.9.8)
$ mu find embed:milk
(since mu version 0.9.8)
$ mu find ""
(since mu version 0.9.7)
Contacts (names + email addresses) are cached separately, and can be
mu cfind (after your messages have been indexed):
$ mu cfind john
mu cfind takes a regular expression for matching.
You can export the contact information to a number of formats for use in e-mail clients. For example:
$ mu cfind --format=mutt-alias
Other formats are:
csv (comma-separated values).
You can retrieve attachments from messages using
mu extract, which takes a
message file as an argument. Without any other arguments, it displays the
MIME-parts of the message. You can then get specific attachments:
$ mu extract --parts=3,4 my-msg-file
will get you parts 3 and 4. You can also extract files based on their name:
$ mu extract my-msg-file '.*\.jpg'
The second argument is a case-insensitive regular expression, and the command
will extract any files matching the pattern – in the example, all
Do not confuse the ‘.*’ regular expression in
mu extract (and
with the ‘*’ wildcard in
Some of the
mu commands, such as
mu cfind and
support colorized output. By default this is turned off, but you can enable
--color, or setting the
MU_COLORS environment variable to
$ mu find --color capibara
mu version 0.9.6)
mu-find man page contains examples for
since version 0.9.8,
mu includes its own e-mail client for
You can view message contents with
mu view; it does not use the database
and simply takes a message file as it’s argument:
$ mu view ~/Maildir/inbox/cur/message24
You can also use
--color to get colorized output, and
--summary to get a
summary of the message contents instead of the whole thing.
If you need to process the results of your queries with some other program, you can return the results as a list of absolute paths to the messages found:
For example, to get the number of lines in all your messages mentioning banana, you could use something like:
$ mu find --exec='wc -l'
Note that we use ‘l’, so the returned message paths will be quoted. This is useful if you have maildirs with spaces in their names.
For further processing, also the
--format=(xml|sexp) can be useful. For
$ mu find --format=xml pancake
will give you a list of pancake-related messages in XML-format.