To search all subdirectories for files using grep you can use the following command:
grep -r pattern directory
where pattern is the search string and directory is the top-level directory to search. The -r or --recursive option tells grep to search recursively through subdirectories.
For example:
grep -r "error" /var/log
This will search for all instances of “error” in all files under the /var/log directory, including subdirectories.