Thorough search for a text file with a specific keyword inside
I seem to have lost a specific file of mine. I forgot its name and the directory it is in, but I know what is inside. I know that (1) the filename ends in ".txt" and (2) I know a unique keyword that I am sure is inside this text file (say, "mykeyword"). Armed with these two facts, what is the best/fastest linux command that I can use to search my entire disk for this specific file?
|
Code:
locate -0 '*.txt' | xargs -0 grep mykeyword |
Code:
find / -name "*.txt" -exec grep mykeyword {} \; |
Thanks for the replies. I was not successful with the locate command. I might have an obsolete database.
Code:
find / -name "*.txt" -exec grep mykeyword {} \; |
Quote:
Code:
grep -H mykeyword |
Splendid!
Code:
find / -name "*.txt" -exec grep -H mykeyword {} \; |
Quote:
|
All times are GMT -5. The time now is 10:46 AM. |