Archive for July 9th, 2009
Using Grep to find a string inside a file (Linux)
by admin on Jul.09, 2009, under Server
Grep is a tool that is used often by system administrators – including myself, however I often have to double check the syntax online – as a result this post is to help me find out how and you of course.
first I recommend to change to the directory that you think or know the file containing the text is in:
- To find the string michael in any file type “grep michael * #this will return a the files if any are found within the directory
- To find the string michael in any file and search recusively in directories under where you are type ”grep -R michael *”
Grep is one of the best tools available to an administrator especially for checking log files out and finding regular patterns.