File – How to Find Files That Do Not Contain a Given String Pattern

directoryfilefindgrep

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

Best Answer

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

$ grep -L "foo" *
Related Question