Search for string recursively in all files and folders

Written by
Date: 2013-02-12 18:59:13 00:00

Today I was moving all my static assets from static2 to static3 server, and after the change I needed to find if there still was an occurence of static2 string. To search all files recursively in all folders of the site, I used grep

grep -r "string" .

That command should be entered in the folder where you want to start the search. The leading dot, says grep to start "here" and the -r option to go recursively for all folders.

If you want to search for the string without caring about upper or lower case.

grep -ri "string" .

The -i option is for "ignore case"