Helm's Technology Blog

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.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • MySpace
  • StumbleUpon
  • Technorati
  • TwitThis
:, ,

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!