You’ve probably found yourself at a UNIX shell prompt and said to yourself, “Self, I need to search through all these directories and files to find the file that has a particular string. Is thing going to be hard? Damn, I wish I had a smart friend who had a blog who would help me out in these situations.” Well, your dreams have come true.

find . -type f -exec grep -i “particular string” {} \; -print

This command will recursively search the directories, starting from where you’re at (substitute the ‘.’ if you want a different directory). It will then execute a particular command (in this case a grep) and finally print out all files that meet the success condition of your exec command. The type parameter just says, “Look at the files only Mr. UNIX OS.”

Do you love me now? or are you wishing I posted something like this?