Monday, July 25, 2011

Using GREP command in Terminal to search the entire directory

GREP command is one of most usefull commands in linux terminal.

Searching entire directory

To search a string in all files and sub-direcotries of directory, use the -nr option with GREP.

grep -nr "SEARCH_STRING" FOLDER 

Eg: For searching for "Hello World" in the current direcory , Use it like

grep -nr "Hello World" . 

1 comment: