Try to run this command if you want to find the file containing any of these words:
grep -rE 'foo1|foo2' .
If you want to find the file containing all of these words,
try this:
grep -r 'foo1' .|grep 'foo2'
If you want to find multiple strings in file on different lines,
you can use
grep -rl 'foo1' .|xargs grep -l 'foo2'
-r
For each directory operand, read and process all files in that
directory, recursively. Follow symbolic links on the command line, but
skip symlinks that are encountered recursively. Note that if no file
operand is given, grep searches the working directory.
-E
Use pattern as the pattern. If this option is used multiple times or
is combined with the -f (--file) option, search for all patterns
given. (-e is specified by POSIX.)
You can read GNU Grep 2.27 to learn more about grep
.
Hope this helps.