Tuesday, August 28, 2012

How to find a content of a file linux

You can find content inside a file by using Linux grep command. eg : If you want to find the usage of text called "Hello". You can type as follows:

grep -r hello .

-r option means read all files under each directory, recursively
hello - means the content what you want to search
. - means the path for this scenario it means from current folder.(You can use absolute path as well eg: /home/gayan/)

Enjoy ~