Linux – What’s the best way to find a string/regex match in files recursively? (UNIX)


I have had to do this several times, usually when trying to find in what files a variable or a function is used.

I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways.

Best Solution

grep -r REGEX .

Replace . with whatever directory you want to search from.