1MU-EASY(1) General Commands Manual MU-EASY(1)
2
3
4
6 mu easy - a quick introduction to mu
7
8
10 mu is a set of tools for dealing with e-mail messages in Maildirs.
11 There are many options, which are all described in the man pages for
12 the various sub-commands. This man pages jumps over all of the details
13 and gives examples of some common use cases. If the use cases described
14 here do not precisely do what you want, please check the more extensive
15 information in the man page about the sub-command you are using -- for
16 example, the mu-index(1) or mu-find(1) man pages.
17
18 NOTE: the index command (and therefore, the ones that depend on that,
19 such as find), require that you store your mail in the Maildir-format.
20 If you don't do so, you can still use the other commands, but you won't
21 be able to index/search your mail.
22
23 By default, mu uses colorized output when it thinks your terminal is
24 capable of doing so. If you don't like color, you can use the --nocolor
25 command-line option, or set either the MU_NOCOLOR or the NO_COLOR envi‐
26 ronment variable to non-empty.
27
28
30 The first time you run the mu commands, you need to initialize it. This
31 is done with the init command.
32
33 $ mu init
34
35 This uses the defaults (see mu-init(1) for details on how to change
36 that).
37
38
39
41 Before you can search e-mails, you'll first need to index them:
42
43 $ mu index
44
45 The process can take a few minutes, depending on the amount of mail you
46 have, the speed of your computer, hard drive etc. Usually, indexing
47 should be able to reach a speed of a few hundred messages per second.
48
49 mu index guesses the top-level Maildir to do its job; if it guesses
50 wrongly, you can use the --maildir option to specify the top-level
51 directory that should be processed. See the mu-index(1) man page for
52 more details.
53
54 Normally, mu index visits all the directories under the top-level
55 Maildir; however, you can exclude certain directories (say, the 'trash'
56 or 'spam' folders) by creating a file called .noindex in the directory.
57 When mu sees such a file, it will exclude this directory and its sub-
58 directories from indexing. Also see .noupdate in the mu-index(1) man‐
59 page.
60
61
63 After you have indexed your mail, you can start searching it. By
64 default, the search results are printed on standard output. Alterna‐
65 tively, the output can take the form of Maildir with symbolic links to
66 the found messages. This enables integration with e-mail clients; see
67 the mu-find(1) man page for details, the syntax of the search parame‐
68 ters and so on. Here, we just give some examples for common cases.
69
70 First, let's search for all messages sent to Julius (Caesar) regarding
71 fruit:
72
73 $ mu find t:julius fruit
74
75 This should return something like:
76
77 2008-07-31T21:57:25 EEST John Milton <jm@example.com> Fere libenter homines id quod volunt credunt
78
79 This means there is a message to 'julius' with 'fruit' somewhere in the
80 message. In this case, it's a message from John Milton. Note that the
81 date format depends on your the language/locale you are using.
82
83 How do we know that the message was sent to Julius Caesar? Well, it's
84 not visible from the results above, because the default fields that are
85 shown are date/sender/subject. However, we can change this using the
86 --fields parameter (see the mu-find(1) man page for the details):
87
88 $ mu find --fields="t s" t:julius fruit
89
90 In other words, display the 'To:'-field (t) and the subject (s). This
91 should return something like:
92 Julius Caesar <jc@example.com> Fere libenter homines id quod volunt credunt
93
94 This is the same message found before, only with some different fields
95 displayed.
96
97 By default, mu uses the logical AND for the search parameters -- that
98 is, it displays messages that match all the parameters. However, we can
99 use logical OR as well:
100
101 $ mu find t:julius OR f:socrates
102
103 In other words, display messages that are either sent to Julius Caesar
104 or are from Socrates. This could return something like:
105
106 2008-07-31T21:57:25 EEST Socrates <soc@example.com> cool stuff
107 2008-07-31T21:57:25 EEST John Milton <jm@example.com> Fere libenter homines id quod volunt credunt
108
109 What if we want to see some of the body of the message? You can get a
110 'summary' of the first lines of the message using the --summary-len
111 option, which will 'summarize' the first n lines of the message:
112
113 $ mu find --summary-len=3 napoleon m:/archive
114
115 1970-01-01T02:00:00 EET Napoleon Bonaparte <nb@example.com> rock on dude
116 Summary: Le 24 février 1815, la vigie de Notre-Dame de la Garde signala le
117 trois-mâts le Pharaon, venant de Smyrne, Trieste et Naples. Comme
118 d'habitude, un pilote côtier partit aussitôt du port, rasa le château
119
120 The summary consists of the first n lines of the message with all
121 superfluous whitespace removed.
122
123 Also note the m:/archive parameter in the query. This means that we
124 only match messages in a maildir called '/archive'.
125
126
128 Let's list a few more queries that may be interesting; please note that
129 searches for message flags, priority and date ranges are only available
130 in mu version 0.9 or later.
131
132 Get all important messages which are signed:
133 $ mu find flag:signed prio:high
134
135 Get all messages from Jim without an attachment:
136 $ mu find from:jim AND NOT flag:attach
137
138 Get all messages where Jack is in one of the contact fields:
139 $ mu find contact:jack
140 This uses the special contact: pseudo-field which matches (from, to, cc
141 and bcc).
142
143 Get all messages in the Sent Items folder about yoghurt:
144 $mu find maildir:'/Sent Items' yoghurt
145 Note how we need to quote search terms that include spaces.
146
147
148 Get all unread messages where the subject mentions Ångström:
149 $ mu find subject:Ångström flag:unread
150 which is equivalent to:
151 $ mu find subject:angstrom flag:unread
152 because does mu is case-insensitive and accent-insensitive.
153
154 Get all unread messages between March 2002 and August 2003 about some
155 bird (or a Swedish rock band):
156 $ mu find date:20020301..20030831 nightingale flag:unread
157
158 Get all messages received today:
159 $ mu find date:today..now
160
161 Get all messages we got in the last two weeks about emacs:
162 $ mu find date:2w..now emacs
163
164 Another powerful feature (since 0.9.6) are wildcard searches, where you
165 can search for the last n characters in a word. For example, you can
166 search for:
167 $ mu find 'subject:soc*'
168 and get mails about soccer, Socrates, society, and so on. Note, it's
169 important to quote the search query, otherwise the shell will interpret
170 the '*'.
171
172 You can also search for messages with a certain attachment using their
173 filename, for example:
174
175 $ mu find 'file:pic*'
176 will get you all messages with an attachment starting with 'pic'.
177
178 If you want to find attachments with a certain MIME-type, you can use
179 the following:
180
181 Get all messages with PDF attachments:
182 $ mu find mime:application/pdf
183
184 or even:
185
186 Get all messages with image attachments:
187 $ mu find 'mime:image/*'
188
189
190 Note that (1) the '*' wildcard can only be used as the rightmost thing
191 in a search query, and (2) that you need to quote the search term,
192 because otherwise your shell will interpret the '*' (expanding it to
193 all files in the current directory -- probably not what you want).
194
195
197 We might also want to display the complete messages instead of the
198 header information. This can be done using mu view command. Note that
199 this command does not use the database; you simply provide it the path
200 to a message.
201
202 Therefore, if you want to display some message from a search query,
203 you'll need its path. To get the path (think location) for our first
204 example we can use:
205
206 $ mu find --fields="l" t:julius fruit
207
208 And we'll get something like:
209 /home/someuser/Maildir/archive/cur/1266188485_0.6850.cthulhu:2,
210 We can now display this message:
211
212 $ mu view /home/someuser/Maildir/archive/cur/1266188485_0.6850.cthulhu:2,
213
214 From: John Milton <jm@example.com>
215 To: Julius Caesar <jc@example.com>
216 Subject: Fere libenter homines id quod volunt credunt
217 Date: 2008-07-31T21:57:25 EEST
218
219 OF Mans First Disobedience, and the Fruit
220 Of that Forbidden Tree, whose mortal taste
221 Brought Death into the World, and all our woe,
222 [...]
223
224
226 While mu find searches for messages, there is also mu cfind to find
227 contacts, that is, names + addresses. Without any search expression, mu
228 cfind lists all of your contacts.
229
230 $ mu cfind julius
231
232 will find all contacts with 'julius' in either name or e-mail address.
233 Note that mu cfind accepts a regular expression.
234
235 mu cfind also supports a --format=-parameter, which sets the output to
236 some specific format, so the results can be imported into another pro‐
237 gram. For example, to export your contact information to a mutt address
238 book file, you can use something like:
239
240 $ mu cfind --format=mutt-alias > ~/mutt-aliases
241
242 Then, you can use them in mutt if you add something like source ~/mutt-
243 aliases to your muttrc.
244
245
247 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
248
249
251 mu(1), mu-init(1), mu-index(1), mu-find(1), mu-mfind(1), mu-mkdir(1),
252 mu-view(1), mu-extract(1)
253
254
255
256User Manuals February 2020 MU-EASY(1)