The locate command is part of the findutils-locate package. It gets its information about where files are on the system from a database that is normally updated once a day, so it cannot be used to find files that have been created or moved very recently unless you manually update the database. If the package is installed, the database will be updated automatically daily, but you can create or update the database manually with the command updatedb.
To find a file using locate is as simple as this example:
[email protected]:~ > locate traceroute
Note that any file whose name contains the string given (in this case traceroute) will be found.
j r - - r The locate utility is located in /usr/bin/locate, but is not installed by default. It ' - ~ ■"■> ■ is very useful, but on a desktop system it takes up some system resources once a day while it updates its database. This is the reason why it is not included in the default installation. But on a modern system, you will hardly notice it, and you will be grateful for the ease of being able to find any file on the system easily.
The updating of the locate database is done daily from the file /etc/cron.daily/suse .de-updatedb, which reads certain parameters from /etc/sysconfig/locate and calls the updatedb command. In /etc/sysconfig/locate you can set whether or not you want the automatic updating to take place at all and which paths you want to be excluded from the database (by default, temporary and spool files are excluded, as are removable media).
Was this article helpful?