1829704 Members
2480 Online
109992 Solutions
New Discussion

Find files

 
SOLVED
Go to solution
Kenn Chen
Advisor

Find files

I would like to find all files which has content of "Hello" word inside the file.
Cyber Zen
4 REPLIES 4
Wieslaw Krajewski
Honored Contributor
Solution

Re: Find files

Hi,

Try

find / -exec file {} \; | grep text | grep Hello

But should remember that command file not always clasify well files.

Rgds.
Permanent training makes master
Laurent Paumier
Trusted Contributor

Re: Find files

find / -type f | xargs grep -l Hello
federico_3
Honored Contributor

Re: Find files

The best solution could be:
find DIR -type f -exec grep -il "Hello" {} \;
Laurent Paumier
Trusted Contributor

Re: Find files

Hi federico,

Your command will exec a grep process for every file found. Whenever you can, use the xargs command which will exec the specified process passing it many files at once. One grep in 10000 files is by far more efficient than 10000 greps in one file...