LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-08-2006, 07:53 AM   #1
rktech83
LQ Newbie
 
Registered: Mar 2006
Posts: 11

Rep: Reputation: 0
Wat is main difference between find and locate command.


There is Two command in Linux for search the file.

1) find : It generate dynamic o/p in the sense that it search in whole system and find the specified name. and also it give error if it can not access some folder which have root priority. Find command can operate with various option.

2) locate : It search in db which is already created in system. so it is not give dynamic o/p. also it has only option.


so, my question is wat is exact algorithm use by find cmd???
and how locate cmd can maintain so much large database of whole system???
 
Old 03-08-2006, 08:38 AM   #2
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 14.2
Posts: 1,491

Rep: Reputation: 50
1st the database is not that large. even if you have 20,000 files or something, that isn't that much data in reality - locate only stores the names and permissions.

i think you've answered you own question really - slocate uses a database search, whereas "find" goes off and does the search each time it's run. however, find can search for things like files over a certain age or size. making it ultimately very powerful. however, it's pretty slow and finding files, whereas locate is very fast...

the find source code is available as per the GPL if you are interested at a code level..........
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/locate an exact file stefaandk Linux - General 2 12-27-2005 08:56 AM
Locate command matt1982 Linux - General 3 01-09-2005 12:22 AM
cannot find a kernel, please locate one bobotoes Linux - Newbie 2 10-07-2004 07:15 PM
How to use locate command MartinOG Linux - Newbie 3 06-07-2004 02:59 PM
What is the main difference between Linux Versions and Manufacturers? phantom87s Linux - Newbie 2 07-15-2003 09:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:36 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
Open Source Consulting | Domain Registration