PDA

View Full Version : [ubuntu] Finding a comment or directive I've used in a file



Maurices5000
March 27th, 2013, 04:23 PM
I typed a comment in a file (using "#" of course) on my linux server, but i can't remember where i put it. is there a way to find a term, word or directive (such as <Limit>) that i've used?

Derek Karpinski
March 27th, 2013, 06:02 PM
Use grep.


grep -r -I 'string you're searching for' /*

That will search starting at '/' recursively through all files, ignoring binary files. It will take a while.

If you remember which directory you put the file in, or the extension of the file, that will speed up the search.

For more options,


man grep

tgalati4
March 27th, 2013, 06:20 PM
It helps to use your initials in your comments:

# TFG 27 Mar 13 Cheesy work around, because I'm too lazy to refactor this code.
#