]> git.notmuchmail.org Git - notmuch/blob - notmuch.1
INSTALL: Mention that xapian-config might be named xapian-config-1.1
[notmuch] / notmuch.1
1 .\" notmuch - Not much of an email program, (just index, search and tagging)
2 .\"
3 .\" Copyright © 2009 Carl Worth
4 .\"
5 .\" Notmuch is free software: you can redistribute it and/or modify
6 .\" it under the terms of the GNU General Public License as published by
7 .\" the Free Software Foundation, either version 3 of the License, or
8 .\" (at your option) any later version.
9 .\"
10 .\" Notmuch is distributed in the hope that it will be useful,
11 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
12 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 .\" GNU General Public License for more details.
14 .\"
15 .\" You should have received a copy of the GNU General Public License
16 .\" along with this program.  If not, see http://www.gnu.org/licenses/ .
17 .\"
18 .\" Author: Carl Worth <cworth@cworth.org>
19 .TH NOTMUCH 1 2009-10-31 "Notmuch 0.1"
20 .SH NAME
21 notmuch \- thread-based email index, search, and tagging
22 .SH SYNOPSIS
23 .B notmuch
24 .IR command " [" args " ...]"
25 .SH DESCRIPTION
26 Notmuch is a command-line based program for indexing, searching,
27 reading, and tagging large collections of email messages.
28
29 The quickest way to get started with Notmuch is to simply invoke the
30 .B notmuch
31 command with no arguments, which will interactively guide you through
32 the process of indexing your mail.
33 .SH NOTE
34 While the command-line program
35 .B notmuch
36 provides powerful functionality, it does not provide the most
37 convenient interface for that functionality. More sophisticated
38 interfaces are expected to be built on top of either the command-line
39 interface, or more likely, on top of the notmuch library
40 interface. See http://notmuchmail.org for more about alternate
41 interfaces to notmuch.
42 .SH COMMANDS
43 The
44 .BR setup
45 command is used to configure Notmuch for first use, (or to reconfigure
46 it later).
47 .RS 4
48 .TP 4
49 .B setup
50
51 Interactively sets up notmuch for first use.
52
53 The setup command will prompt for your full name, your primary email
54 address, any alternate email addresses you use, and the directory
55 containing your email archives. Your answers will be written to a
56 configuration file in ${HOME}/.notmuch-config . This configuration
57 file will be created with descriptive comments, making it easy to edit
58 by hand later to change the configuration. Or you can run
59 .B "notmuch setup"
60 again to change the configuration.
61
62 The mail directory you specify can contain any number of
63 sub-directories and should primarily contain only files with individual
64 email messages (eg. maildir or mh archives are perfect). If there are
65 other, non-email files (such as indexes maintained by other email
66 programs) then notmuch will do its best to detect those and ignore
67 them.
68
69 Mail storage that uses mbox format, (where one mbox file contains many
70 messages), will not work with notmuch. If that's how your mail is
71 currently stored, it is recommended you first convert it to maildir
72 format with a utility such as mb2md before running
73 .B "notmuch setup" .
74
75 Invoking
76 .B notmuch
77 with no command argument will run
78 .B setup
79 if the setup command has not previously been completed.
80 .RE
81
82 The
83 .B new
84 command is used to incorporate new mail into the notmuch database.
85 .RS 4
86 .TP 4
87 .B new
88
89 Find and import any new messages to the database.
90
91 The
92 .B new
93 command scans all sub-directories of the database, performing
94 full-text indexing on new messages that are found. Each new message
95 will automatically be tagged with both the
96 .BR inbox " and " unread
97 tags.
98
99 You should run
100 .B "notmuch new"
101 once after first running
102 .B "notmuch setup"
103 to create the initial database. The first run may take a long time if
104 you have a significant amount of mail (several hundred thousand
105 messages or more). Subsequently, you should run
106 .B "notmuch new"
107 whenever new mail is delivered and you wish to incorporate it into the
108 database. These subsequent runs will be much quicker than the initial
109 run.
110
111 Note:
112 .B notmuch new
113 runs (other than the first run) will skip any read-only directories,
114 so you can use that to mark directories that will not receive any new
115 mail (and make
116 .B notmuch new
117 even faster).
118
119 Invoking
120 .B notmuch
121 with no command argument will run
122 .B new
123 if
124 .B "notmuch setup"
125 has previously been completed, but
126 .B "notmuch new"
127 has not previously been run.
128 .RE
129
130 Several of the notmuch commands accept search terms with a common
131 syntax. See the
132 .B "SEARCH SYNTAX"
133 section below for more details on the supported syntax.
134
135 The
136 .BR search " and "show
137 commands are used to query the email database.
138 .RS 4
139 .TP 4
140 .BR search " [options...] <search-term>..."
141
142 Search for messages matching the given search terms, and display as
143 results the threads containing the matched messages.
144
145 The output consists of one line per thread, giving a thread ID, the
146 date of the newest (or oldest, depending on the sort option) matched
147 message in the thread, the number of matched messages and total
148 messages in the thread, the names of all participants in the thread,
149 and the subject of the newest (or oldest) message.
150
151 Supported options for
152 .B search
153 include
154 .RS 4
155 .TP 4
156 .BR \-\-max\-threads= <value>
157
158 Restricts displayed search results to a subset of the complete results
159 that would match the terms. With this option, no more than <value>
160 thread results will be displayed. If this option is not used, then all
161 matching threads will be displayed. See also the
162 .B \-\-first
163 option.
164
165 .TP
166 .BR \-\-first= <value>
167
168 Omits the first <value> threads from the search results that would
169 otherwise be displayed. Together with the
170 .BR \-\-max\-threads
171 option, this can be used to perform incremental searches. For example,
172 the first 50 thread results can be displayed with
173 .B "\-\-first=0 \-\-max\-threads=50"
174 and the next 50 could be displayed with
175 .B "\-\-first=50 \-\-max\-threads=50"
176 etc.
177
178 .TP
179 .BR \-\-sort= ( newest\-first | oldest\-first )
180
181 This option can be used to present results in either chronological order
182 .RB ( oldest\-first )
183 or reverse chronological order
184 .RB ( newest\-first ).
185
186 Note: The thread order will be distinct between these two options
187 (beyond being simply reversed). When sorting by
188 .B oldest\-first
189 the threads will be sorted by the oldest message in each thread, but
190 when sorting by
191 .B newest\-first
192 the threads will be sorted by the newest message in each thread.
193
194 By default, results will be displayed in reverse chronological order,
195 (that is, the newest results will be displayed first).
196
197 See the
198 .B "SEARCH SYNTAX"
199 section below for details of the supported syntax for <search-terms>.
200 .RE
201 .TP
202 .BR show " <search-term>..."
203
204 Shows all messages matching the search terms.
205
206 The messages will be grouped and sorted based on the threading (all
207 replies to a particular message will appear immediately after that
208 message in date order). The output is not indented by default, but
209 depth tags are printed so that proper indentation can be performed by
210 a post-processor (such as the emacs interface to notmuch).
211
212 The  output format  is plain-text,  with all  text-content  MIME parts
213 decoded. Various components in the output,
214 .RB ( message ", " header ", " body ", " attachment ", and MIME " part ),
215 will be delimited by easily-parsed markers. Each marker consists of a
216 Control-L character (ASCII decimal 12), the name of the marker, and
217 then either an opening or closing brace, ('{' or '}'), to either open
218 or close the component.
219
220 A common use of
221 .B notmuch show
222 is to display a single thread of email messages. For this, use a
223 search term of "thread:<thread-id>" as can be seen in the first
224 column of output from the
225 .B notmuch search
226 command.
227
228 See the
229 .B "SEARCH SYNTAX"
230 section below for details of the supported syntax for <search-terms>.
231 .RE
232
233 The
234 .B reply
235 command is useful for preparing a template for an email reply.
236
237 .TP
238 .BR reply " <search-term>..."
239
240 Constructs a reply template for a set of messages.
241
242 To make replying to email easier,
243 .B notmuch reply
244 takes an existing set of messages and constructs a suitable mail
245 template. The Reply-to header (if any, otherwise From:) is used for
246 the To: address. Vales from the To: and Cc: headers are copied, but
247 not including any of the current user's email addresses (as configured
248 in primary_mail or other_email in the .notmuch-config file) in the
249 recipient list
250
251 It also builds a suitable new subject, including Re: at the front (if
252 not already present), and adding the message IDs of the messages being
253 replied to to the References list and setting the In-Reply-To: field
254 correctly.
255
256 Finally, the original contents of the emails are quoted by prefixing
257 each line with '> ' and included in the body.
258
259 The resulting message template is output to stdout.
260
261 See the
262 .B "SEARCH SYNTAX"
263 section below for details of the supported syntax for <search-terms>.
264
265 Note: It is most common to use
266 .B "notmuch reply"
267 with a search string matching a single message, (such as
268 id:<message-id>), but it can be useful to reply to several messages at
269 once. For example, when a series of patches are sent in a single
270 thread, replying to the entire thread allows for the reply to comment
271 on issue found in multiple patches.
272 .RE
273
274 The
275 .B tag
276 command is the only command available for manipulating database
277 contents.
278
279 .RS 4
280 .TP 4
281 .BR tag " +<tag>|-<tag> [...] [--] <search-term>..."
282
283 Add/remove tags for all messages matching the search terms.
284
285 Tags prefixed by '+' are added while those prefixed by '-' are
286 removed. For each message, tag removal is performed before tag
287 addition.
288
289 The beginning of <search-terms> is recognized by the first
290 argument that begins with neither '+' nor '-'. Support for
291 an initial search term beginning with '+' or '-' is provided
292 by allowing the user to specify a "--" argument to separate
293 the tags from the search terms.
294
295 See the
296 .B "SEARCH SYNTAX"
297 section below for details of the supported syntax for <search-terms>.
298 .RE
299
300 The
301 .BR dump " and " restore
302 commands can be used to create a textual dump of email tags for backup
303 purposes, and to restore from that dump
304
305 .RS 4
306 .TP 4
307 .BR dump " [<filename>]"
308
309 Creates a plain-text dump of the tags of each message.
310
311 The output is to the given filename, if any, or to stdout.
312
313 These tags are the only data in the notmuch database that can't be
314 recreated from the messages themselves.  The output of notmuch dump is
315 therefore the only critical thing to backup (and much more friendly to
316 incremental backup than the native database files.)
317 .TP
318 .BR restore " <filename>"
319
320 Restores the tags from the given file (see
321 .BR "notmuch dump" "."
322
323 Note: The dump file format is specifically chosen to be
324 compatible with the format of files produced by sup-dump.
325 So if you've previously been using sup for mail, then the
326 .B "notmuch restore"
327 command provides you a way to import all of your tags (or labels as
328 sup calls them).
329 .SH SEARCH SYNTAX
330 Several notmuch commands accept a common syntax for search terms.
331
332 The search terms can consist of free-form text (and quoted phrases)
333 which will match all messages that contain all of the given
334 terms/phrases in the body, the subject, or any of the sender or
335 recipient headers.
336
337 In addition to free text, the following prefixes can be used to force
338 terms to match against specific portions of an email, (where
339 <brackets> indicate user-supplied values):
340
341         from:<name-or-address>
342
343         to:<name-or-address>
344
345         subject:<word-or-quoted-phrase>
346
347         attachment:<word>
348
349         tag:<tag>
350
351         id:<message-id>
352
353         thread:<thread-id>
354
355 The
356 .B from:
357 prefix is used to match the name or address of the sender of an email
358 message.
359
360 The
361 .B to:
362 prefix is used to match the names or addresses of any recipient of an
363 email message, (whether To, Cc, or Bcc).
364
365 Any term prefixed with
366 .B subject:
367 will match only text from the subject of an email. Searching for a
368 phrase in the subject is supported by including quotation marks around
369 the phrase, immediately following
370 .BR subject: .
371
372 The
373 .B attachment:
374 prefix can be used to search for specific filenames (or extensions) of
375 attachments to email messages.
376
377 For
378 .BR tag: ,
379 valid tag values include
380 .BR inbox " and " unread
381 by default for new messages added by
382 .B notmuch new
383 as well as any other tag values added manually with
384 .BR "notmuch tag" .
385
386 For
387 .BR id: ,
388 message ID values are the literal contents of the Message-ID: header
389 of email messages, but without the '<', '>' delimiters.
390
391 The
392 .B thread:
393 prefix can be used with the thread ID values that are generated
394 internally by notmuch (and do not appear in email messages). These
395 thread ID values can be seen in the first column of output from
396 .B "notmuch search"
397
398 In addition to individual terms, multiple terms can be
399 combined with Boolean operators (
400 .BR and ", " or ", " not
401 , etc.). Each term in the query will be implicitly connected by a
402 logical AND if no explicit operator is provided, (except that terms
403 with a common prefix will be implicitly combined with OR until we get
404 Xapian defect #402 fixed).
405
406 Parentheses can also be used to control the combination of the Boolean
407 operators, but will have to be protected from interpretation by the
408 shell, (such as by putting quotation marks around any parenthesized
409 expression).
410 .SH SEE ALSO
411 The emacs-based interface to notmuch (available as
412 .B notmuch.el
413 in the Notmuch distribution).
414
415 The notmuch website:
416 .B http://notmuchmail.org
417 .SH CONTACT
418 Feel free to send questions, comments, or kudos to the notmuch mailing
419 list <notmuch@notmuchmail.org> . Subscription is not required before
420 posting, but is available from the notmuchmail.org website.
421
422 Real-time interaction with the Notmuch community is available via IRC
423 (server: irc.freenode.net, channel: #notmuch).