Gmail Tip #19: Advanced Search – Query Words

One of Gmail’s excellent features is its Search function. Searching can be as simple as entering a keyword or two into the Search field at the top of any page to very complex using Gmail’s advanced “Query Words” to better constrain searches. Read more to better understand how “Query Words” can help you with your advanced message searching…

Clicking the “Show Search Options” link will open up a pane containing several entry fields and dropdowns. This lets you easily specify more detailed search criteria. For example, say you want to search for all email that is unread, regardless of under what Label it is filed. Simply click the “Search:” dropdown, select “Unread Mail” and click the “Search Mail” button. Gmail will display a list of all unread mesasges. Likewise, you can select specific Labels and you can enter specific terms. It’s very powerful and useful.

But as more savvy users, we often crave, as Tim The Toolman Taylor says, “More power!” Gmail also provides users the ability to prefix their search keywords with “query words” that instruct Gmail how to search. And there is no need to open the Search Options–these can be entered in the simple search window at the top of any page.

For example, say you want to search for all messages Labeled with the “Family” Label. You could open the “Show Search Options” pane, select the “Family” Label from the dropdown, and click “Search Mail”. Or, you could just enter into the search box at the top of any page “label:family” and hit Enter! Both do the same thing, just in different ways.

But this type of searching goes way beyond this by letting you search using more complex criteria. For example, building on our example above, say you want to search for messages containing attachments from your family sent before May 21, 2004? You would simply enter the following advanced search criteria:

label:family has:attachment before:2004/5/21

Yes, this could actually be done in the Search Options pane, but in addition to the available search criteria fields, query words not only let you search using criteria not included in the Search Options pane, (like “cc:” and “bcc:”) but you can do “compound” searches otherwise not available in the Search Options pane. For example:

label:doctors label:statements has:attachment before:2004/5/21 in:anywhere

would return all messages with both Labels of “Doctors” and “Statements” containing attachments, sent before May 21, 2004, existing anywhere in my account including the Trash and Spam views.

It’s pretty powerful, and fairly intuitive once you get the hang of it.

For more information, you should check the direct link to Gmail’s “How do I use advanced search?” help page found [here] (You may need to be logged into your Gmail account to access this page.)

Here is table of “query words” from that page:

Operator Definition Example(s)
from: Used to specify the
sender
Example – from:amy
Meaning – Messages from Amy
to: Used to specify a recipient Example – to:david
Meaning – All messages that were sent to David (by you or someone else)

subject:

Search for words in the subject line
Example – subject:dinner
Meaning – Messages that have
the word “dinner” in the subject

OR

Search for messages matching term A or term B*

*OR must be in all
caps
Example – from:amy OR from:david
Meaning – Messages from Amy or from David

(hyphen)

Used to exclude messages from your search
Example – dinner -movie
Meaning – Messages that contain the word “dinner” but do not contain
the word “movie”
label: Search
for messages by label*
*There isn’t a search operator for unlabeled messages
Example – from:amy label:friends
Meaning – Messages from Amy that
have
the label “friends”

has:attachment
Search for
messages with an attachment
Example –
from:david has:attachment

Meaning – Messages from David that have
an attachment

filename:

Search for an attachment by name or type
Example –
filename:physicshomework.txt

Meaning – Messages with an
attachment named “physicshomework.txt”

Example –
label:work filename:pdf

Meaning – Messages labeled
“work” that also have a PDF file as an attachment


” “

(quotes)

Used to search for an exact phrase*
*Capitalization isn’t taken into consideration
Example –
“i’m feeling lucky”

Meaning – Messages containing
the phrase “i’m feeling lucky” or “I’m feeling lucky”

Example –
subject:”dinner and a movie”

Meaning – Messages containing
the phrase “dinner and a movie” in the subject


( )

Used to group words
Used specify terms that shouldn’t be excluded
Example –
from:amy (dinner OR movie)

Meaning – Messages from Amy
that contain either the word “dinner” or the word “movie”

Example –
subject:(dinner movie)

Meaning – Messages in which
the subject contains both the word “dinner” and the word “movie”


in:anywhere

Search for messages anywhere in your account*
*Messages in ‘Spam’ and ‘Trash’ are excluded from
searches by default
Example – in:anywhere
subject:movie

Meaning – Messages in ‘All Mail’,
‘Spam’, and ‘Trash’ that contain the word “movie”

in:inbox
in:trash
in:spam

Search for messages in ‘Inbox’, ‘Trash’, or ‘Spam’
Example – in:trash
from:amy

Meaning – Messages from Amy that
are in the trash
is:starred
is:unread
is:read

Search for messages that are starred, unread or read
Example –
is:read is:starred from:David

Meaning – Message from David that
have been read and are marked with a star

cc:
bcc:

Used to specify recipients in the ‘cc’ or ‘bcc’ fields
Example –
cc:david

Meaning – Messages that were cc-ed to David

after:
before:
Search for messages after or before a certain date*
*Date must be in yyyy/mm/dd format.
Example –
after:2004/4/17 before:2004/4/18

Meaning – Messages sent on April
17, 2004.*
*More precisely: Messages sent on or after April 17, 2004, but
before April 18, 2004.

(reprinted without permission)

Close Menu