LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 12: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, 12:38 PM   #2
vls
Member
 
Registered: Jan 2005
Location: The grassy knoll
Distribution: Slackware,Debian
Posts: 192

Rep: Reputation: 30
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, 03:50 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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 08:21 AM
CVS Command Line tool not installed? TehFlyingDutchman Linux - Newbie 4 11-20-2005 06:51 PM
DHCP command line tool cold Fedora 1 11-09-2005 10:14 AM
Is there a command line tool to create images? J_Szucs Linux - Software 5 11-11-2004 02:51 AM
PHP: what's wrong with this line (shell_exec, find, xargs, grep)? J_Szucs Programming 3 11-19-2003 07:44 PM


All times are GMT -5. The time now is 02:00 PM.

Main Menu
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