How to find a text string which may be present in some unknown file in entire filesystem

findgrepubuntu-10.04

I am stuck up with a problem I have a line
'something' in some file.
In which file is this line that I have forgotten.
In the entire root file system I would like to find out which file and where is this line.
So how can I go for this.I have used find but when I used find then I knew the name of file in this case I do not know name of file also.
It is a Ubuntu server 10.04 So what can I do to find out which file has this string.

Best Answer

I always use:

find / -xdev | xargs grep "string"

That'll give you a list of all of the matched strings along with the actual files they're in.