Forrest logo
back to the grep tool

grep:ai:c547b

find file with certain string along with other string
$ grep -r 'string1' * | grep 'string2'
try on your machine

This command will search for files containing 'string1' and then search within those results for 'string2'. It will return the filenames and the lines where both strings are found.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • find file with certain string along with other string?
back to the grep tool