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 wrong, you can use the --maildir option to specify the top-level direc‐
51 tory that should be processed. See the mu-index(1) man page for more
52 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 de‐
64 fault, 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 You can use the mu fields command to get information about all possible
71 fields and flags.
72
73 First, let's search for all messages sent to Julius (Caesar) regarding
74 fruit:
75
76 $ mu find t:julius fruit
77
78 This should return something like:
79
80 2008-07-31T21:57:25 EEST John Milton <jm@example.com> Fere libenter homines id quod volunt credunt
81
82 This means there is a message to 'julius' with 'fruit' somewhere in the
83 message. In this case, it's a message from John Milton. Note that the
84 date format depends on your the language/locale you are using.
85
86 How do we know that the message was sent to Julius Caesar? Well, it's
87 not visible from the results above, because the default fields that are
88 shown are date/sender/subject. However, we can change this using the
89 --fields parameter (try mu fields to see all the details):
90
91 $ mu find --fields="t s" t:julius fruit
92
93 In other words, display the 'To:'-field (t) and the subject (s). This
94 should return something like:
95 Julius Caesar <jc@example.com> Fere libenter homines id quod volunt credunt
96
97 This is the same message found before, only with some different fields
98 displayed.
99
100 By default, mu uses the logical AND for the search parameters -- that
101 is, it displays messages that match all the parameters. However, we can
102 use logical OR as well:
103
104 $ mu find t:julius OR f:socrates
105
106 In other words, display messages that are either sent to Julius Caesar
107 or are from Socrates. This could return something like:
108
109 2008-07-31T21:57:25 EEST Socrates <soc@example.com> cool stuff
110 2008-07-31T21:57:25 EEST John Milton <jm@example.com> Fere libenter homines id quod volunt credunt
111
112 What if we want to see some of the body of the message? You can get a
113 'summary' of the first lines of the message using the --summary-len op‐
114 tion, which will 'summarize' the first n lines of the message:
115
116 $ mu find --summary-len=3 napoleon m:/archive
117
118 1970-01-01T02:00:00 EET Napoleon Bonaparte <nb@example.com> rock on dude
119 Summary: Le 24 février 1815, la vigie de Notre-Dame de la Garde signala le
120 trois-mâts le Pharaon, venant de Smyrne, Trieste et Naples. Comme
121 d'habitude, un pilote côtier partit aussitôt du port, rasa le château
122
123 The summary consists of the first n lines of the message with all su‐
124 perfluous whitespace removed.
125
126 Also note the m:/archive parameter in the query. This means that we
127 only match messages in a maildir called '/archive'.
128
129
131 Let's list a few more queries that may be interesting; please note that
132 searches for message flags, priority and date ranges are only available
133 in mu version 0.9 or later.
134
135 Get all important messages which are signed:
136 $ mu find flag:signed prio:high
137
138 Get all messages from Jim without an attachment:
139 $ mu find from:jim AND NOT flag:attach
140
141 Get all messages where Jack is in one of the contact fields:
142 $ mu find contact:jack
143 This uses the special contact: pseudo-field which matches (from, to, cc
144 and bcc).
145
146 Get all messages in the Sent Items folder about yoghurt:
147 $mu find maildir:'/Sent Items' yoghurt
148 Note how we need to quote search terms that include spaces.
149
150
151 Get all unread messages where the subject mentions Ångström:
152 $ mu find subject:Ångström flag:unread
153 which is equivalent to:
154 $ mu find subject:angstrom flag:unread
155 because does mu is case-insensitive and accent-insensitive.
156
157 Get all unread messages between March 2002 and August 2003 about some
158 bird (or a Swedish rock band):
159 $ mu find date:20020301..20030831 nightingale flag:unread
160
161 Get all messages received today:
162 $ mu find date:today..now
163
164 Get all messages we got in the last two weeks about emacs:
165 $ mu find date:2w..now emacs
166
167 Another powerful feature (since 0.9.6) are wildcard searches, where you
168 can search for the last n characters in a word. For example, you can
169 search for:
170 $ mu find 'subject:soc*'
171 and get mails about soccer, Socrates, society, and so on. Note, it's
172 important to quote the search query, otherwise the shell will interpret
173 the '*'.
174
175 You can also search for messages with a certain attachment using their
176 filename, for example:
177
178 $ mu find 'file:pic*'
179 will get you all messages with an attachment starting with 'pic'.
180
181 If you want to find attachments with a certain MIME-type, you can use
182 the following:
183
184 Get all messages with PDF attachments:
185 $ mu find mime:application/pdf
186
187 or even:
188
189 Get all messages with image attachments:
190 $ mu find 'mime:image/*'
191
192
193 Note that (1) the '*' wildcard can only be used as the rightmost thing
194 in a search query, and (2) that you need to quote the search term, be‐
195 cause otherwise your shell will interpret the '*' (expanding it to all
196 files in the current directory -- probably not what you want).
197
198
200 We might also want to display the complete messages instead of the
201 header information. This can be done using mu view command. Note that
202 this command does not use the database; you simply provide it the path
203 to a message.
204
205 Therefore, if you want to display some message from a search query,
206 you'll need its path. To get the path (think location) for our first
207 example we can use:
208
209 $ mu find --fields="l" t:julius fruit
210
211 And we'll get something like:
212 /home/someuser/Maildir/archive/cur/1266188485_0.6850.cthulhu:2,
213 We can now display this message:
214
215 $ mu view /home/someuser/Maildir/archive/cur/1266188485_0.6850.cthulhu:2,
216
217 From: John Milton <jm@example.com>
218 To: Julius Caesar <jc@example.com>
219 Subject: Fere libenter homines id quod volunt credunt
220 Date: 2008-07-31T21:57:25 EEST
221
222 OF Mans First Disobedience, and the Fruit
223 Of that Forbidden Tree, whose mortal taste
224 Brought Death into the World, and all our woe,
225 [...]
226
227
229 While mu find searches for messages, there is also mu cfind to find
230 contacts, that is, names + addresses. Without any search expression, mu
231 cfind lists all of your contacts.
232
233 $ mu cfind julius
234
235 will find all contacts with 'julius' in either name or e-mail address.
236 Note that mu cfind accepts a regular expression.
237
238 mu cfind also supports a --format=-parameter, which sets the output to
239 some specific format, so the results can be imported into another pro‐
240 gram. For example, to export your contact information to a mutt address
241 book file, you can use something like:
242
243 $ mu cfind --format=mutt-alias > ~/mutt-aliases
244
245 Then, you can use them in mutt if you add something like source ~/mutt-
246 aliases to your muttrc.
247
248
250 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
251
252
254 mu(1), mu-init(1), mu-index(1), mu-find(1), mu-mfind(1), mu-mkdir(1),
255 mu-view(1), mu-extract(1)
256
257
258
259User Manuals February 2020 MU-EASY(1)