finding files
Hi,
If I want to find all files on my box which contain a certain word, what should I do? Thanks, Noha |
Quote:
If the former, find or locate (if installed) will do it. If the latter, a recursive grep from the appropriate starting point will do it. |
I would like to know how to search inside files. But for using find do this
list files of "filename" find /directory/where/you/want/to/search/ -type f | grep "filename" List directories of "filename" find /directory/where/you/want/to/search/ -type d | grep "filename" |
Quote:
You will have to run it as root because of the many directories/files to which the normal user doesn't have access. Replace "search string" with the word/phrase you want to find. |
Also use -H on the greps
|
This is the command I used, and this is what I was given, what does this mean?
find / -type f | xargs grep -H "million" xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option Noha |
Use this command.
# find / -exec -H grep "your_pattern_string" {} \; |
I did not find the file which contains the word "million".
It is a regular file and I am sure it is somewhere in my box. Thanks, Noha |
Quote:
If you have no clue where it could be, I'd use: # grep -IRHi 'million' /* If you have some idea about which subdirectory it would be under, that'll speed the search up for you. |
Maybe the word "million" is not lower-case? Following one of the examples above, you can try
Code:
find / -type f -exec grep -Hiw million {} \; |
All times are GMT -5. The time now is 02:38 PM. |