0

I want to search recursively for files containing a string. I want to search:

  1. Files in and under the directory I'm standing in currently
  2. A specific directory.

I want to see only results. I don't want to see "permission denied" messages or other things. Only the file locations that contain the string I search for.

How do I do it?

1 Answer 1

4

grep -lr searchstring * /path/to/dir 2>/dev/null

2
  • 2
    Using . instead of * will include hidden files in the current directory as well, not just in the subdirectories. May 22, 2012 at 18:19
  • Were using grep -r | sed s/:.*//.
    – 174140
    Sep 4, 2014 at 8:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .