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