Search text on files (Mac – OS X)

OS X comes with a powerful search tool called mdfind:

mdfind "text to find"

To search on a specific folder use the flag -onlyin /path/to/folder

Search using grep

Way more slower but also effective would be using grep command:

grep -sr  "text to find" /path/to/folder

The flag -s is for ignoring errors, this way we will only get positive results on screen.
The flag -r is for a recursive search following all subfolders.

Leave a Reply

Your email address will not be published. Required fields are marked *