1 <h1>NOTMUCH-SEARCH-TERMS(7)</h1>
6 notmuch-search-terms - Syntax for notmuch queries
12 <b>notmuch</b> <b>count</b> [<u>options...</u>] <<u>search-term</u>>...
16 <b>notmuch</b> <b>dump</b> [ <<u>filename</u>> ] [--] [ <<u>search-term</u>>...]
20 <b>notmuch</b> <b>search</b> [<u>options</u>...] <<u>search-term</u>>...
24 <b>notmuch</b> <b>show</b> [<u>options</u>...] <<u>search-term</u>>...
28 <b>notmuch</b> <b>tag</b> +<<u>tag></u>|-<<u>tag</u>> [...] [--] <<u>search-term</u>>...
34 Several notmuch commands accept a common syntax for search terms.
38 The search terms can consist of free-form text (and quoted phrases)
39 which will match all messages that contain all of the given
40 terms/phrases in the body, the subject, or any of the sender or recipi-
45 As a special case, a search string consisting of exactly a single
46 asterisk ("*") will match all messages.
50 In addition to free text, the following prefixes can be used to force
51 terms to match against specific portions of an email, (where <brackets>
52 indicate user-supplied values):
56 from:<name-or-address>
64 subject:<word-or-quoted-phrase>
72 tag:<tag> (or is:<tag>)
84 folder:<directory-path>
88 The <b>from:</b> prefix is used to match the name or address of the sender of
93 The <b>to:</b> prefix is used to match the names or addresses of any recipient
94 of an email message, (whether To, Cc, or Bcc).
98 Any term prefixed with <b>subject:</b> will match only text from the subject
99 of an email. Searching for a phrase in the subject is supported by
100 including quotation marks around the phrase, immediately following <b>sub-</b>
105 The <b>attachment:</b> prefix can be used to search for specific filenames (or
106 extensions) of attachments to email messages.
110 For <b>tag:</b> and <b>is:</b> valid tag values include <b>inbox</b> and <b>unread</b> by default
111 for new messages added by <b>notmuch</b> <b>new</b> as well as any other tag values
112 added manually with <b>notmuch</b> <b>tag</b>.
116 For <b>id:</b>, message ID values are the literal contents of the Message-ID:
117 header of email messages, but without the '<', '>' delimiters.
121 The <b>thread:</b> prefix can be used with the thread ID values that are gen-
122 erated internally by notmuch (and do not appear in email messages).
123 These thread ID values can be seen in the first column of output from
124 <b>notmuch</b> <b>search</b>
128 The <b>folder:</b> prefix can be used to search for email message files that
129 are contained within particular directories within the mail store. Only
130 the directory components below the top-level mail database path are
131 available to be searched.
135 In addition to individual terms, multiple terms can be combined with
136 Boolean operators ( <b>and</b>, <b>or</b>, <b>not</b> , etc.). Each term in the query will
137 be implicitly connected by a logical AND if no explicit operator is
138 provided, (except that terms with a common prefix will be implicitly
139 combined with OR until we get Xapian defect #402 fixed).
143 Parentheses can also be used to control the combination of the Boolean
144 operators, but will have to be protected from interpretation by the
145 shell, (such as by putting quotation marks around any parenthesized
150 Finally, results can be restricted to only messages within a particular
151 time range, (based on the Date: header) with a syntax of:
155 <initial-timestamp>..<final-timestamp>
159 Each timestamp is a number representing the number of seconds since
160 1970-01-01 00:00:00 UTC. This is not the most convenient means of
161 expressing date ranges, but until notmuch is fixed to accept a more
162 convenient form, one can use the date program to construct timestamps.
163 For example, with the bash shell the following syntax would specify a
164 date range to return messages from 2009-10-01 until the current time:
168 $(date +%s -d 2009-10-01)..$(date +%s)
174 <b>notmuch</b>(1), <b>notmuch-config</b>(1), <b>notmuch-count</b>(1), <b>notmuch-dump</b>(1), <b>not-</b>
175 <b>much-hooks</b>(5), <b>notmuch-new</b>(1), <b>notmuch-reply</b>(1), <b>notmuch-restore</b>(1),
176 <b>notmuch-search</b>(1), <b>notmuch-show</b>(1), <b>notmuch-tag</b>(1)
179 <h1>Notmuch 0.13.2</h1>