How to find text within a file and have it search multiple subfolders

findgrepsearch

I'm looking for a function name and the folder structure is deep and there are a lot of files to look though.

Usually I go with something like find * | grep functionname but is that the best way?

Best Answer

$ find . -type f -print0 | xargs -0 grep foo
$ grep -r foo . # GNU grep only

and in zsh with setopt extendedglob,

$ grep foo **/*(.)
Related Question