Search inside files for a word

Spotlight searches the contents of documents, not just names: type the phrase after ⌘Space. For plain text files, grep -rl lists every file in a folder that contains it.

Without Terminal

  1. Press ⌘Space and type the phrase.
  2. Spotlight lists documents that contain it, as well as ones named for it.

In one command

List the text files in Documents that contain a phrase:

grep -rl "quarterly invoice" ~/Documents

Or let Spotlight search contents of every kind of document:

mdfind -onlyin ~/Documents "quarterly invoice" 2>/dev/null
Or just ask Titan
Which of my documents mentions the Acme contract renewal? Do it with Titan

Titan is an AI that lives on your computer: tell it what you need and it does it while you watch — you press Return, nothing runs by itself. What is Titan?

Titan isn’t on this computer yet. Get Titan, then press the button again — the task will be waiting, typed in.

Related

Find a file by its nameFind the file you worked on yesterday