0

I want to find a file or folder containing a keyword. How can I do this from the command line? I am starting in a directory that I know contains this keyword somewhere, but am not sure where. It could be several directories down or could be just a couple.

I don't want to find the keyword inside a file, I want to find a directory or filename that includes the keyword.

2 Answers 2

1

cd to directory and give command:

find | grep -i 'keyword'
0
0

Use grep,

$> grep -r "keyword" /path/to/find/the/fil

If you want to find it from current location,

$> grep -r "keyword" .

man grep for detail usage.

2
  • grep looks inside files. I don't want to look inside files. I want the keyword to be part of the filename.
    – Mars
    Commented Sep 13, 2014 at 1:10
  • Oops, sorry, didn't notice that. I think @rnso 's answer is what you want?
    – n5c
    Commented Sep 13, 2014 at 1:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.