How can I use grep to show just filenames on Linux?
Asked 07 September, 2021
Viewed 1.1K times
  • 56
Votes

How can I use grep to show just file-names (no in-line matches) on Linux?

I am usually using something like:

find . -iname "*php" -exec grep -H myString {} ;

How can I just get the file-names (with paths), but without the matches? Do I have to use xargs? I didn't see a way to do this on my grep man page.

4 Answer