]> git.notmuchmail.org Git - notmuch/blob - notmuch.1
notmuch: Break notmuch.c up into several smaller files.
[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 All commands need to know where your mail (and the notmuch database)
44 are stored. This is ${HOME}/mail by default. An alternate location can
45 be specified with the
46 .B NOTMUCH_BASE
47 environment variable.
48
49 The
50 .BR setup " and " new
51 commands are used to add new mail messages to the notmuch database.
52 .RS 4
53 .TP 4
54 .B setup
55
56 Interactively sets up notmuch for first use.
57
58 The setup command will prompt for the directory containing your email
59 archives, and will then proceed to build a database that indexes the
60 mail to allow for fast search of the archive.
61
62 This directory can contain any number of sub-directories and should
63 primarily contain only files with indvidual email messages
64 (eg. maildir or mh archives are perfect). If there are other,
65 non-email files (such as indexes maintained by other email programs)
66 then notmuch will do its best to detect those and ignore them.
67
68 Mail storage that uses mbox format, (where one mbox file contains many
69 messages), will not work with notmuch. If that's how your mail is
70 currently stored, it is recommended you first convert it to maildir
71 format with a utility such as mb2md before running
72 .BR "notmuch setup" .
73
74 Invoking
75 .B notmuch
76 with no command argument will run
77 .B setup
78 if the setup command has not previously been completed.
79
80 .TP
81 .B new
82
83 Find and import any new messages to the database.
84
85 The
86 .B new
87 command scans all sub-directories of the database, adding new messages
88 that are found. Each new message will automatically be tagged with
89 both the
90 .BR inbox and unread
91 tags.
92
93 Note:
94 .B notmuch new
95 will skip any read-only directories, so you can use that to mark
96 directories that will not receive any new mail (and make
97 .B notmuch new
98 faster).
99 .RE
100
101 The
102 .BR search " and "show
103 commands are used to query the email database.
104 .RS 4
105 .TP 4
106 .BR search " <search-term>..."
107
108 Search for messages matching the given search terms, and display as
109 results the threads containing the matched messages.
110
111 The output consists of one line per thread, giving a thread ID, the
112 date of the oldest matched message in the thread, and the subject from
113 that message.
114
115 Currently, in addition to free text (and quoted phrases) which match
116 terms appearing anywhere within an email, the following prefixes can
117 be used to search specific portions of an email, (where <brackets>
118 indicate user-supplied values):
119
120         from:<name-or-address>
121
122         to:<name-or-address>
123
124         subject:<word-or-quoted-phrase>
125
126         tag:<tag>
127
128         id:<message-id>
129
130         thread:<thread-id>
131
132 The from: prefix is used to match the name or address of the sender of
133 an email message.
134
135 The to: prefix is used to match the names or addresses of any
136 recipient of an email message, (whether To, Cc, or Bcc).
137
138 Any term prefixed with subject: will match only text from
139 the subject of an email. Quoted phrases are supported when
140 searching with: subject:\"this is a phrase\".
141
142 Valid tag values include
143 .BR inbox " and " unread
144 by default for new messages added by
145 .B notmuch new
146 as well as any other tag values added manually with
147 .BR "notmuch tag" .
148
149 Message ID values are the literal contents of the Message-ID: header
150 of email messages, but without the '<', '>' delimiters.
151
152 Thread ID values are generated internally by notmuch but can be seen
153 in the first column of output from
154 .B notmuch search
155 for example.
156
157 In addition to individual terms, multiple terms can be
158 combined with Boolean operators (
159 .BR and ", " or ", " not
160 , etc.). each term in the query will be implicitly connected by a
161 logical AND if no explicit operator is provided, (except that terms
162 with a common prefix will be implicitly combined with OR until we get
163 Xapian defect #402 fixed).
164
165 Parentheses can also be used to control the combination of the Boolean
166 operators, but will have to be protected from interpretation by the
167 shell, (such as by putting quotation marks around any parenthesized
168 expression).
169 .TP
170 .BR show " <search-term>..."
171
172 Shows all messages matching the search terms.
173
174 See the documentation of
175 .B search
176 for details of the supported syntax of search terms.
177
178 A common use of
179 .B notmuch show
180 is to display a single thread of email messages. For this, use a
181 search term of "thread:<thread-id>" as can be seen in the first
182 column of output from the
183 .B notmuch search
184 command.
185
186 All messages will be displayed in date order. The output format is
187 plain-text, with all text-content MIME parts decoded. Various
188 components in the output,
189 .RB ( message ", " header ", " body ", " attachment ", and MIME " part ),
190 will be delimited by easily-parsed markers. Each marker consists of a
191 Control-L character (ASCII decimal 12), the name of the marker, and
192 then either an opening or closing brace, ('{' or '}'), to either open
193 or close the component.
194 .RE
195
196 The
197 .B tag
198 command is the only command available for manipulating database
199 contents.
200
201 .RS 4
202 .TP 4
203 .BR tag " +<tag>|-<tag> [...] [--] <search-term>..."
204
205 Add/remove tags for all messages matching the search terms.
206
207 The search terms are handled exactly as in
208 .B "notmuch search"
209 so one can use that command first to see what will be modified.
210
211 Tags prefixed by '+' are added while those prefixed by '-' are
212 removed. For each message, tag removal is before tag addition.
213
214 The beginning of <search-terms> is recognized by the first
215 argument that begins with neither '+' nor '-'. Support for
216 an initial search term beginning with '+' or '-' is provided
217 by allowing the user to specify a "--" argument to separate
218 the tags from the search terms.
219
220 Caution: If you run
221 .B "notmuch new"
222 between reading a thread with
223 .B "notmuch show"
224 and removing the "inbox" tag for that thread with
225 .B "notmuch tag"
226 then you create the possibility of moving some messages from that
227 thread out of your inbox without ever reading them. The easiest way to
228 avoid this problem is to not run
229 .B "notmuch new"
230 between reading mail and removing tags.
231 .RE
232
233 The
234 .BR dump " and " restore
235 commands can be used to create a textual dump of email tags for backup
236 purposes, and to restore from that dump
237
238 .RS 4
239 .TP 4
240 .BR dump " [<filename>]"
241
242 Creates a plain-text dump of the tags of each message.
243
244 The output is to the given filename, if any, or to stdout.
245
246 These tags are the only data in the notmuch database that can't be
247 recreated from the messages themselves.  The output of notmuch dump is
248 therefore the only critical thing to backup (and much more friendly to
249 incremental backup than the native database files.)
250 .TP
251 .BR restore " <filename>"
252
253 Restores the tags from the given file (see
254 .BR "notmuch dump" "."
255
256 Note: The dump file format is specifically chosen to be
257 compatible with the format of files produced by sup-dump.
258 So if you've previously been using sup for mail, then the
259 .B "notmuch restore"
260 command provides you a way to import all of your tags (or labels as
261 sup calls them).
262 .SH ENVIRONMENT
263 .B NOTMUCH_BASE
264 Set to the directory which contains the user's mail to be indexed and
265 searched by notmuch. Notmuch will create a directory named
266 .B .notmuch
267 at the toplevel of this directory where it will store its database.
268 .SH SEE ALSO
269 The emacs-based interface to notmuch (available as
270 .B notmuch.el
271 in the Notmuch distribution).
272
273 The notmuch website:
274 .B http://notmuchmail.org