Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

Search For Text Inside Files On Linux

Written by: on 31 May 2016 04:58 PM 31 May 2016 04:58 PM

Visit us today and know the easiest way to search for text inside files on Linux. Follow the steps and do it yourself.

To search for text inside files on Linux the easiest way is to type:

grep -H -r "texttofind" /home/ 2>/dev/null

grep : The command
-H : Return just the filename
-r  : Search recursively
 "texttofind" : The text you are searching for - must be in quotation marks
/home/ : The directory to start searching in, to search the entire server just put /
2>/dev/null : This prevents output of file not found or access denied errors 

 

(0 vote(s))
Helpful
Not helpful