69

How can I update the cache / index of locate? I installed new packages and the files are clearly not yet indexed. So which command do I have to commit, in order for the indexer to trigger?

I'm currently working on debian jessie (testing): with Linux mbpc 3.13-1-amd64 #1 SMP Debian 3.13.7-1 (2014-03-25) x86_64 GNU/Linux

migrated from serverfault.com Apr 14 '14 at 18:49

This question came from our site for system and network administrators.

  • If your locate is from the GNU Find Utilities project (which, if you are using Debian Jessie, it probably is), then you can find the project's website and documentation here: gnu.org/software/findutils – sampablokuper Apr 23 '18 at 17:48
95

The command is:

sudo updatedb

See man updatedb for more details.

  • 1
    as I remember you have to be root to do that, or sudo it – David Lakatos Apr 14 '14 at 8:11
  • 1
    And put it as a cron. – Florin Asăvoaie Apr 14 '14 at 8:17
  • 16
    If you're not root, you shouldn't be on ServerFault anyway... – Jenny D Apr 14 '14 at 8:30
  • 3
    @JennyD This isn't ServerFault... – John Hunt Dec 1 '14 at 14:08
  • 2
    One remark here, this command runs for ~13 minutes on Debian Stretch RC3 and Sata SSD drive, so be patient. – Marecky Jun 1 '17 at 20:33
19

On OSX this is: sudo /usr/libexec/locate.updatedb

Which can be linked with: sudo ln -s /usr/libexec/locate.updatedb /usr/local/bin/updatedb

Seems silly to have to make a symbolic link for a standard unix command, but there it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.