If you don’s use Spotlight or mdfind, turn off its indexing overhead entirely: mdutil -i off The command to search for the word “essay” only within the Documents folder: mdfind -onlyin ~/Documents essay
Anything Spotlight can find, mdfind can find it too. Spotlight’s database and functionality is available in the command mdfind. It maintains, automatically running in the background, a database that indexes every file and its metadata (such as date modified, etc.). Including searching inside files and file metadata.
Here are my notes on finding (and replacing) stuff within a Mac,