Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am searching for every file within a root directory and want to search every subdirectory as well. I have tried

grep -r "message" *

but I am not sure that this searches every subdirectory, any suggestions?

share|improve this question

migrated from stackoverflow.com Jun 20 '13 at 11:57

This question came from our site for professional and enthusiast programmers.

    
Have tou tried it ? It's recursive as well. No need a wildcard *, a dot . is sufficient (current dir) –  sputnick Jun 19 '13 at 21:41
2  
my main suggestion in this case is, you should read the manual. –  Endoro Jun 19 '13 at 21:42
    
I have tried it, it only comes up with one instance which doesnt make any sense so I was wondering if maybe its only searching the direct subdirectories. –  Spencer Smith Jun 19 '13 at 21:44

2 Answers 2

or can both do it easily & fits your needs as well :

ack -r "pattern" 

or

grep -r "pattern" .
share|improve this answer

you can do with find command also. I have written in my blog post

If you are looking for exact match of keyword with grep command you can read my another post I wrote this both post today

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.