Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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) – Gilles Quenot Jun 19 '13 at 21:41
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

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

ack -r "pattern" 


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

You must log in to answer this question.