How do I find files that do not contain a given string pattern?

How do I find out the files in the current directory which do not contain the word foo (using grep)?

17 s
17

If your grep has the -L (or --files-without-match) option:

$ grep -L "foo" *

Leave a Comment