LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   locate (https://www.linuxquestions.org/questions/linux-newbie-8/locate-126880/)

juanb 12-18-2003 05:28 AM

locate
 
Hi !!

I read the man pages for loacte command,but I didnt understand what this command does .

can someone explain please.

thanks

MartinN 12-18-2003 05:34 AM

With locate you can find a file in your file system. It works with a database that (on most distributions) is updated automatically once a day.

The alternative is the 'find' command, but that is much slower, since it searches through the entire file system.

Regards
Martin

jkobrien 12-18-2003 05:36 AM

Hi,

'locate -u' creates an index, or database, of all the files on your system. You don't generally have to do this though, as it's set up to run once a day on most systems. An exception might be if you've just installed a lot of software, then you might want to run it (as root).

'locate <filename>' uses that index to tell you where the file called <filename> is.

In fact, at least on my system, locate is a symbolic link to another program called 'slocate'. Which means that when you call locate, you're really calling slocate. This program does exactly the same thing except that if a user is not allowed to see a particular file or directory, it will bear this in mind when doing a search.

John


All times are GMT -5. The time now is 05:40 PM.