23 views

Recursive search in Linux using grep

grep -r PATTERN ./

From the Manpage:

 -r, --recursive
Read  all  files under each directory, recursively, following symbolic links
only if they are on the command line.  This is equivalent to the -d  recurse
option.

Use the i switch along with r, if you want to search ignoring the letter case

grep -i -r PATTERN ./

Or use it together,

grep -ir MyPattern ./

Grep recursive examples

Finding error messages in the log files

[askdevops@localhost~/examples]$ grep -ir failed ./
./log/output4.log:Sat Aug 10 10:38:37 UTC 2010 Process FAILED
./log/output4.log:Sat Aug 10 10:39:37 UTC 2010 Process FAILED
Sep 19, 2010 by | 23 views
DevOpsRun.com is LIVE!

Articles for DevOps Geeks
MobaXterm Customization
CHMOD Explained!
Bash history powerful tips
Ubuntu bash from Windows
..