LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 02-18-2006, 01:22 PM   #1
rsheridan6
Member
 
Registered: Mar 2003
Location: Kansas City
Distribution: Debian unstable
Posts: 57

Rep: Reputation: 21
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?
 
Old 02-18-2006, 01:38 PM   #2
vls
Member
 
Registered: Jan 2005
Location: The grassy knoll
Distribution: Slackware,Debian
Posts: 192

Rep: Reputation: 31
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.
 
Old 02-18-2006, 04:50 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me to understand this command: find...| grep -e ... | xargs rm -f ROBERT483599 Red Hat 2 02-14-2006 09:21 AM
CVS Command Line tool not installed? TehFlyingDutchman Linux - Newbie 4 11-20-2005 07:51 PM
DHCP command line tool cold Fedora 1 11-09-2005 11:14 AM
Is there a command line tool to create images? J_Szucs Linux - Software 5 11-11-2004 03:51 AM
PHP: what's wrong with this line (shell_exec, find, xargs, grep)? J_Szucs Programming 3 11-19-2003 08:44 PM


All times are GMT -5. The time now is 06:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration