Updatedb

From LQWiki
Jump to navigation Jump to search

updatedb is the command for updating the locate database. In reality, the locate database is usually the slocate database, and the updatedb command is often a symlink to slocate, using the -u flag or a similar option. Updatedb is usually run as a cron job.

While the updatedb should be sufficient for creating the initial database (the -u option is supposed to be default) it sometimes seems necessary to issue it explicitly.

The only other particularly useful option is -e directory where 'directory' is one or more directories to be excluded from the database. For example, to exlude the /mnt directory (which contains mount point directories for removable drives), you could modify the crontab entry like this: updatedb -e /mnt.

See its man page(s) for a complete list of options.