Search specific text in MacOS
Spotlight search is great if you’re looking for file or folder names. But to search for specific words inside text or code files in a folder, the following command line method is much more effective.
Step 1: Open the Terminal app, use the
cd command to navigate to the folder where you want to search for your desired text or file name.
Step 2: Use the
grep command to search inside this folder & folders further inside it.
grep -ir 'space_below' .
space_below is the word you are looking for. You can also search for text with quotes such as class or ID names by doing
Notice the quotes & the dot in the 2nd step, they are required. This should be particularly useful for developers and writers who deal with text & need to find very specific ones.