LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Command line tool to find(1) or grep(1) faster? (https://www.linuxquestions.org/questions/linux-software-2/command-line-tool-to-find-1-or-grep-1-faster-416885/)

rsheridan6 02-18-2006 12:22 PM

Command line tool to find(1) or grep(1) faster?
 
I frequently search through certain big directories, and it takes a long time. Surely there's something that makes this faster? Any suggestions?

vls 02-18-2006 12:38 PM

Quote:

Originally Posted by rsheridan6
I frequently search through certain big directories, and it takes a long time. Surely there's something that makes this faster? Any suggestions?

'locate' (and slocate) is much faster than find, as long as you keep the db up-to-date. (updatedb).

Code:

$ locate "/big/dir/files*"
grep is going to work as fast as the hardware will permit, I suppose.

pixellany 02-18-2006 03:50 PM

find and locate typically are used to look for files. grep is used to look for words in a file--or in a data stream. Obviously, the data stream can be generated by doing a list of files---as in ls /dirname/*|grep keyword.

Using grep as a general tool to find files does not seem like the best choice.


All times are GMT -5. The time now is 01:26 PM.