4.1 Database Locations

There can be multiple file name databases. Users can select which databases locate searches using the LOCATE_PATH environment variable or a command line option. The system administrator can choose the file name of the default database, the frequency with which the databases are updated, and the directories for which they contain entries. File name databases are updated by running the updatedb program, typically nightly.

In networked environments, it often makes sense to build a database at the root of each filesystem, containing the entries for that filesystem. updatedb is then run for each filesystem on the fileserver where that filesystem is on a local disk, to prevent thrashing the network.

See Invoking updatedb, for the description of the options to updatedb. These options can be used to specify which directories are indexed by each database file.

The default location for the locate database depends on how findutils is built, but the findutils installation accompanying this manual uses the default location /usr/local/var/locatedb.

If no database exists at /usr/local/var/locatedb but the user did not specify where to look (by using ‘-d’ or setting LOCATE_PATH), then locate will also check for a “secure” database in /var/lib/slocate/slocate.db.