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