| Red Hat Docs > Red Hat Manuals > Archived Red Hat Linux Manuals > |
Locating Files and DirectoriesThere will be times when we know a file or directory exists but we won't know where to find it. Searching for a file or directory can be easier with the locate command. With locate , we'll see every related file or directory which matches our search criterion. Let's say we want to search for all files related to the finger command.
The locate command uses a database to check for files and directories which match the string finger .
It's a handy command which works very quickly -- as long as the database is up to date. That database is automatically updated on a nightly basis, from cron . What's cron ? It's a small program that runs in the background, performing various tasks -- such as updating the locate database -- at regularly scheduled intervals.
So what happens if we:
This might mean that cron rarely has a chance to update the slocate database, which is used to catalogue locations of files. But we can just update the database manually. Let's give it a try. First, su to root (type su in at the prompt, then type your rootpassword). Now, at the shell prompt, type:
After perhaps a few minutes, the slocate database will be current. |
||||||||