Linux/Ubuntu grep a directory for a word. The quick version.

The explanationless version:

find ./ -name "my_file_mask" | xargs grep -i my_search_term

Thus, if I’m searching for the word “pork” in all files:

find ./ | xargs grep -i pork

Or if I’m searching for pork in all “.budget” files:

find ./ -name "*.budget" | xargs grep -i pork

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">