5.2. Using Locate

Locate is a very useful too to find files on the system. For example, to locate files with the word GENERIC in them:

% locate GENERIC
/kernel.GENERIC
/usr/src/sys/alpha/conf/GENERIC
/usr/src/sys/i386/conf/GENERIC
/usr/src/sys/pc98/conf/GENERIC

Note: Filenames are case-sensitive in FreeBSD!

Obviously, the results are going to vary from system to system depending on what has been installed. The locate is rebuilt weekly provided you leave the system running overnight. Otherwise, on a new installation or on systems that are shut down each night, the databases will need to be built manually.

One of the first things that should be done on a new installation is to build the various databases that makes it easier to find things. As root, perform the following commands:

# periodic daily
# periodic weekly
# periodic monthly

The locate database is updated on a weekly basis. Occasionally, it would be convenient to update the locate database manually. This is easily done:

# /usr/libexec/locate.updatedb