Finding files that contain certain text

December 11th, 2005

I keep forgetting how to do this and then having to look it up. So here, for quicker access next time I forget, is how it's done:

To find files in or below the current directory that contain the text string "if I only had a brain" enter the command:

find . -type f -print | xargs grep 'if I only had a brain' | more

Thanks to:
www.geocities.com/samarstan/linux/penguin/linuxuser.html
for reminding me how it was done on this occasion.

Comments are closed.