Linux: Recursively search through files for a pattern
I’ve been using a horrific monstrosity of a find command for this, and I just found out that grep can handle this by itself. Watch:
grep -rl 'your pattern' your_directory
For example, say you’re in the web root and you need to find every file which calls a certain function. You’d run:
grep -rl 'function_name' *
So easy. I’m so dumb.
By the way, the ‘-r’ makes it recursive and the ‘-l’ makes it just list the filename (instead of the filename and the context of the match).