]> git.notmuchmail.org Git - notmuch/blob - notmuch.1
notmuch search: Document the from, to, and subject prefixes.
[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, the supported search terms are as follows, (where
116 <brackets> indicate user-supplied values):
117
118         tag:<tag>
119         id:<message-id>
120         thread:<thread-id>
121
122 Valid tag values include
123 .BR inbox " and " unread
124 by default for new messages added by
125 .B notmuch new
126 as well as any other tag values added manually with
127 .BR "notmuch tag" .
128
129 Message ID values are the literal contents of the Message-ID: header
130 of email messages, but without the '<', '>' delimiters.
131
132 Thread ID values are generated internally by notmuch but can be seen
133 in the first column of output from
134 .B notmuch search
135 for example.
136
137 In addition to individual terms, multiple terms can be
138 combined with Boolean operators (
139 .BR and ", " or ", " not
140 , etc.). each term in the query will be implicitly connected by a
141 logical AND if no explicit operator is provided, (except that terms
142 with a common prefix will be implicitly combined with OR until we get
143 Xapian defect #402 fixed).
144
145 Parentheses can also be used to control the combination of the Boolean
146 operators, but will have to be protected from interpretation by the
147 shell, (such as by putting quotation marks around any parenthesized
148 expression).
149 .TP
150 .BR show " <thread-ID>"
151
152 Show the thread with the given thread ID.
153
154 Displays each message in the thread on stdout.
155
156 Thread ID values are given as the first column in the output of the
157 "notmuch search" command. These are the random-looking strings of 32
158 characters.
159 .RE
160
161 The
162 .B tag
163 command is the only command available for manipulating database
164 contents.
165
166 .RS 4
167 .TP 4
168 .BR tag " +<tag>|-<tag> [...] [--] <search-term>..."
169
170 Add/remove tags for all messages matching the search terms.
171
172 The search terms are handled exactly as in
173 .B "notmuch search"
174 so one can use that command first to see what will be modified.
175
176 Tags prefixed by '+' are added while those prefixed by '-' are
177 removed. For each message, tag removal is before tag addition.
178
179 The beginning of <search-terms> is recognized by the first
180 argument that begins with neither '+' nor '-'. Support for
181 an initial search term beginning with '+' or '-' is provided
182 by allowing the user to specify a "--" argument to separate
183 the tags from the search terms.
184
185 Caution: If you run
186 .B "notmuch new"
187 between reading a thread with
188 .B "notmuch show"
189 and removing the "inbox" tag for that thread with
190 .B "notmuch tag"
191 then you create the possibility of moving some messages from that
192 thread out of your inbox without ever reading them. The easiest way to
193 avoid this problem is to not run
194 .B "notmuch new"
195 between reading mail and removing tags.
196 .RE
197
198 The
199 .BR dump " and " restore
200 commands can be used to create a textual dump of email tags for backup
201 purposes, and to restore from that dump
202
203 .RS 4
204 .TP 4
205 .BR dump " [<filename>]"
206
207 Creates a plain-text dump of the tags of each message.
208
209 The output is to the given filename, if any, or to stdout.
210
211 These tags are the only data in the notmuch database that can't be
212 recreated from the messages themselves.  The output of notmuch dump is
213 therefore the only critical thing to backup (and much more friendly to
214 incremental backup than the native database files.)
215 .TP
216 .BR restore " <filename>"
217
218 Restores the tags from the given file (see
219 .BR "notmuch dump" "."
220
221 Note: The dump file format is specifically chosen to be
222 compatible with the format of files produced by sup-dump.
223 So if you've previously been using sup for mail, then the
224 .B "notmuch restore"
225 command provides you a way to import all of your tags (or labels as
226 sup calls them).
227 .SH ENVIRONMENT
228 .B NOTMUCH_BASE
229 Set to the directory which contains the user's mail to be indexed and
230 searched by notmuch. Notmuch will create a directory named
231 .B .notmuch
232 at the toplevel of this directory where it will store its database.
233 .SH SEE ALSO
234 The emacs-based interface to notmuch (available as
235 .B notmuch.el
236 in the Notmuch distribution).
237
238 The notmuch website:
239 .B http://notmuchmail.org