Ramin Hossaini (blog)

4Nov/091

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 make me happy:
  • Twitter
  • Facebook
  • Digg
  • StumbleUpon

Related posts:

  1. Performing WordPress upgrades (Linux)
  2. Recompile invalid objects in an Oracle schema
  3. Linux: Tar and Zip
  4. Facebook lacks a simple feature
  5. Wubi – An easy way to Linux
Tagged as: Leave a comment
Comments (1) 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.


Leave a comment


Please leave these two fields as-is:

No trackbacks yet.

Bear