Does locate update its database each time I remove a file?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Secure Locate provides a secure way to index and quickly search for all files on your system regardless
of ownership. It uses incremental encoding just like GNU locate to compress its database to make search-
ing faster, but it will also check file permissions and ownership before displaying matched entries so
that users will not see files they do not have access to
Presumably that would imply that if the file no longer exists then the user would not have access to it and it would not be displayed.
I would swear that locate went on displaying erased files long time after they had been erased as long as I did not run updatedb! What is curious is that I have not changed my slackware version.
Just a guess: Perhaps if you use locate as root it determines that you have no access restrictions and bypasses the permission tests - and therefore the 'existance' test as well.
No If you delete a file, it remains in slocate.db until the next update. That said, if you subsequently searched for that deleted file, locate (slocate) checks for physical existence, because that file no longer exist, it's entry in slocate.db will be removed. In this case the database is updated.
FYI, with a default, normal install of Slackware, updatedb is run daily at 0440 via a cron script in /etc/cron.daily/
Last edited by chrisretusn; 04-25-2012 at 08:56 PM.
Note also that locate has two options (-e/-E) that check whether each matching file actually exists at that time, before printing the results. See the man page.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.