Ramin Hossaini (blog)

4Nov/092

Search through files for a string (Linux)

To search a directory recursively for specific text or a string, use:

find . -exec grep "string to find" '{}' \; -print
Share and Enjoy:
  • Twitter
  • Digg
  • del.icio.us
  • Facebook
  • Reddit
  • StumbleUpon

Related posts:

  1. Performing Wordpress upgrades (Linux)
  2. Wubi – An easy way to Linux
  3. Facebook lacks a simple feature
Tagged as: Leave a comment
Comments (2) Trackbacks (0)
  1. When searching for something very specific like an error code, I use what you’ve describe here.

    When searching for a term where I’m simply guessing might be relevant, I typically use the -l flag with grep to just print the file name rather than the match. Usually the path or name gives me a good idea about whether the file is relevant. I’ll pick the more relevant files to use grep for searches inside.

  2. Makes sense! Thanks Ezra!


Leave a comment


Please leave these two fields as-is:

No trackbacks yet.