1MU EASY(7) Miscellaneous Information Manual MU EASY(7)
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
19 NOTE: the index command (and therefore, the ones that depend on that,
20 such as find), require that you store your mail in the Maildir-format.
21 If you don't do so, you can still use the other commands, but you won't
22 be able to index/search your mail.
23
24
25 By default, mu uses colorized output when it thinks your terminal is
26 capable of doing so. If you don't like color, you can use the --nocolor
27 command-line option, or set either the MUNOCOLOR or the NOCOLOR envi‐
28 ronment variable to non-empty.
29
30
32 The first time you run the mu commands, you need to initialize it. This
33 is done with the init command.
34
35 $ mu init
36
37
38
39 This uses the defaults (see mu-init(1) for details on how to change
40 that).
41
42
43
45 Before you can search e-mails, you'll first need to index them:
46
47 $ mu index
48
49
50
51 The process can take a few minutes, depending on the amount of mail you
52 have, the speed of your computer, hard drive etc. Usually, indexing
53 should be able to reach a speed of a few hundred messages per second.
54
55
56 mu index guesses the top-level Maildir to do its job; if it guesses
57 wrong, you can use the --maildir option to specify the top-level direc‐
58 tory that should be processed. See the *mu-index*(1) man page for more
59 details.
60
61
62 Normally, mu index visits all the directories under the top-level
63 Maildir; however, you can exclude certain directories (say, the 'trash'
64 or 'spam' folders) by creating a file called .noindex in the directory.
65 When mu sees such a file, it will exclude this directory and its sub-
66 directories from indexing. Also see .noupdate in the *mu-index*(1)
67 manpage.
68
69
71 After you have indexed your mail, you can start searching it. By de‐
72 fault, the search results are printed on standard output. Alterna‐
73 tively, the output can take the form of Maildir with symbolic links to
74 the found messages. This enables integration with e-mail clients; see
75 the *mu-find*(1) man page for details, the syntax of the search parame‐
76 ters and so on. Here, we just give some examples for common cases.
77
78
79 You can use the mu fields command to get information about all possible
80 fields and flags.
81
82
83 First, let's search for all messages sent to Julius (Caesar) regarding
84 fruit:
85
86 $ mu find t:julius fruit
87
88
89
90 This should return something like:
91
92 2008-07-31T21:57:25 EEST John Milton <jm@example.com> Fere libenter homines id quod volunt credunt
93
94
95
96 This means there is a message to 'julius' with 'fruit' somewhere in the
97 message. In this case, it's a message from John Milton. Note that the
98 date format depends on your the language/locale you are using.
99
100
101 How do we know that the message was sent to Julius Caesar? Well, it's
102 not visible from the results above, because the default fields that are
103 shown are date/sender/subject. However, we can change this using the
104 --fields parameter (try mu fields to see all the details):
105
106 $ mu find --fields="t s" t:julius fruit
107
108
109
110 In other words, display the 'To:'-field (t) and the subject (s). This
111 should return something like:
112 Julius Caesar <jc@example.com> Fere libenter homines id quod volunt credunt
113
114
115
116 This is the same message found before, only with some different fields
117 displayed.
118
119
120 By default, mu uses the logical AND for the search parameters -- that
121 is, it displays messages that match all the parameters. However, we can
122 use logical OR as well:
123
124 $ mu find t:julius OR f:socrates
125
126
127
128 In other words, display messages that are either sent to Julius Caesar
129 or are from Socrates. This could return something like:
130
131 2008-07-31T21:57:25 EEST Socrates <soc@example.com> cool stuff
132 2008-07-31T21:57:25 EEST John Milton <jm@example.com> Fere libenter homines id quod volunt credunt
133
134
135
136 What if we want to see some of the body of the message? You can get a
137 'summary' of the first lines of the message using the --summary-len op‐
138 tion, which will
139
140 $ mu find --summary-len=3 napoleon m:/archive
141
142
143 1970-01-01T02:00:00 EET Napoleon Bonaparte <nb@example.com> rock on dude
144 Summary: Le 24 février 1815, la vigie de Notre-Dame de la Garde signala le
145 trois-mâts le Pharaon, venant de Smyrne, Trieste et Naples. Comme
146 d'habitude, un pilote côtier partit aussitôt du port, rasa le château
147
148
149
150 The summary consists of the first n lines of the message with all su‐
151 perfluous whitespace removed.
152
153
154 Also note the m:/archive parameter in the query. This means that we
155 only match messages in a maildir called '/archive'.
156
157
159 Let's list a few more queries that may be interesting; please note that
160 searches for message flags, priority and date ranges are only available
161 in mu version 0.9 or later.
162
163
164 Get all important messages which are signed:
165 *$ mu find flag:signed prio:high *
166
167
168
169 Get all messages from Jim without an attachment:
170 *$ mu find from:jim AND NOT flag:attach*
171
172
173
174 Get all messages where Jack is in one of the contact fields:
175 *$ mu find contact:jack*
176
177
178 This uses the special contact: pseudo-field which matches (from, to, cc
179 and bcc).
180
181
182 Get all messages in the Sent Items folder about yoghurt:
183 *$mu find maildir:'/Sent Items' yoghurt*
184
185
186 Note how we need to quote search terms that include spaces.
187
188
189
190 Get all unread messages where the subject mentions Ångström:
191 *$ mu find subject:Ångström flag:unread*
192
193
194 which is equivalent to:
195 *$ mu find subject:angstrom flag:unread*
196
197
198 because does mu is case-insensitive and accent-insensitive.
199
200
201 Get all unread messages between March 2002 and August 2003 about some
202 bird (or a Swedish rock band):
203 *$ mu find date:20020301..20030831 nightingale flag:unread*
204
205
206
207 Get all messages received today:
208 *$ mu find date:today..now*
209
210
211
212 Get all messages we got in the last two weeks about emacs:
213 *$ mu find date:2w..now emacs*
214
215
216
217 Another powerful feature (since 0.9.6) are wildcard searches, where you
218 can search for the last n characters in a word. For example, you can
219 search for:
220 *$ mu find 'subject:soc*'*
221
222
223 and get mails about soccer, Socrates, society, and so on. Note, it's
224 important to quote the search query, otherwise the shell will interpret
225 the '*'.
226
227
228 You can also search for messages with a certain attachment using their
229 filename, for example:
230
231 *$ mu find 'file:pic*'*
232
233
234 will get you all messages with an attachment starting with 'pic'.
235
236
237 If you want to find attachments with a certain MIME-type, you can use
238 the following:
239
240
241 Get all messages with PDF attachments:
242 *$ mu find mime:application/pdf*
243
244
245
246 or even:
247
248
249 Get all messages with image attachments:
250 *$ mu find 'mime:image/*'*
251
252
253
254
255 Note that (1) the '*' wildcard can only be used as the rightmost thing
256 in a search query, and (2) that you need to quote the search term, be‐
257 cause otherwise your shell will interpret the '*' (expanding it to all
258 files in the current directory -- probably not what you want).
259
260
262 We might also want to display the complete messages instead of the
263 header information. This can be done using mu view command. Note that
264 this command does not use the database; you simply provide it the path
265 to a message.
266
267
268 Therefore, if you want to display some message from a search query,
269 you'll need its path. To get the path (think *l*ocation) for our first
270 example we can use:
271
272 $ mu find --fields="l" t:julius fruit
273
274
275
276 And we'll get something like:
277 /home/someuser/Maildir/archive/cur/1266188485_0.6850.cthulhu:2,
278
279
280
281 We can now display this message:
282
283 $ mu view /home/someuser/Maildir/archive/cur/1266188485_0.6850.cthulhu:2,
284 From: John Milton <jm@example.com>
285 To: Julius Caesar <jc@example.com>
286 Subject: Fere libenter homines id quod volunt credunt
287 Date: 2008-07-31T21:57:25 EEST
288
289 OF Mans First Disobedience, and the Fruit
290 Of that Forbidden Tree, whose mortal taste
291 Brought Death into the World, and all our woe,
292 [...]
293
294
295
297 While mu find searches for messages, there is also mu cfind to find
298 contacts, that is, names + addresses. Without any search expression, mu
299 cfind lists all of your contacts.
300
301 $ mu cfind julius
302
303
304
305 will find all contacts with 'julius' in either name or e-mail address.
306 Note that mu cfind accepts a regular expression (as per pcre(3))
307
308
309 mu cfind also supports a --format=-parameter, which sets the output to
310 some specific format, so the results can be imported into another pro‐
311 gram. For example, to export your contact information to a mutt address
312 book file, you can use something like:
313
314 $ mu cfind --format=mutt-alias > ~/mutt-aliases
315
316
317
318 Then, you can use them in mutt if you add something like source ~/mutt-
319 aliases to your muttrc.
320
321
323 Please report bugs at https://github.com/djcb/mu/issues.
324
325
327 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
328
329
331 This manpage is part of mu 1.10.5.
332
333
334 Copyright © 2022-2023 Dirk-Jan C. Binnema. License GPLv3+: GNU GPL ver‐
335 sion 3 or later https://gnu.org/licenses/gpl.html. This is free soft‐
336 ware: you are free to change and redistribute it. There is NO WARRANTY,
337 to the extent permitted by law.
338
339
341 mu(1), mu-init(1), mu-index(1), mu-find(1), mu-mfind(1), mu-mkdir(1),
342 mu-view(1), mu-extract(1)
343
344
345
346 MU EASY(7)