Find text within files

May 1st, 2008
No Gravatar

Stuck trying to find text within files on Linux?

cd /directory_tree_you_want_to_search
find . -type f -exec grep -l "string to find" {} \; -print

Easy!

Bookmark it del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Propeller | Yahoo


Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Geekery, Linux category.

2 Responses to “Find text within files”

  1. TonyNo Gravatar Says:

    grep -lir ’some text’ *

  2. KieranNo Gravatar Says:

    Almost as good, but I found it freaked out with symbolic links occasionally.

Leave a Reply