To recursively search for a text in files contained in a file hierarchy, use the following command:
$ grep "text" . -R -n
In this command, . specifies the current directory.
The options -R and -r mean the same thing when used with grep.
Consider this example:
$ cd src_dir
$ grep "test_function()" . -R -n
./miscutils/test.c:16:test_function();
test_function() exists in line number 16 of miscutils/test.c. The -R option is particularly useful if you are searching for a phrase in a website or source code tree. It is equivalent to this command:
$ find . -type f | xargs grep "test_function()"