Ever need to find a file that contains some text? Hate trying to remember how to do it so you google it all the time? This post is one I reference often. I do not recommend spending your valuable brain-space on useless info. Just remember how to find the answer and you’ll be golden.

This one is a quickie because it’s mainly for me to remember:

[code lang=text]
find . -type f -exec grep -l "seting" {} +
find /etc/ -type f -name "*.conf" -print0 | xargs -I {} -0 grep "nameserver" "{}"
find /path/to/dir -type f -print0 | xargs -0 grep -l "foo"
[/code]

Hope this helps!

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=""> <s> <strike> <strong>