But sometimes the database will be out of sync with whats really on the hard drives.
Well upatedb and locate are nice things but they require to run updatedb regularly (either updatedb runs regularly and this slows down your system at inconvenient times, or locate shows references to files which are not there anymore).
So I think that instead of setting up locate/updatedb it would perhaps be better to get familiar with (the far more powerful) find.
1) When does the database of locate command gets updated?
2) Do I ever need to change the update time of database? 4) Why do I need a find command when I can search things faster with locate command? DESCRIPTION updatedb creates or updates a database used by locate(1).
If the database already exists, its data is reused to avoid rereading directories that have not changed.
updatedb is usually run daily by cron to update the default database but if you don’t want to wait, you can launch it manually too.
For instance, once I installed a package and I wanted to figure out the path of a specific file.