Make your own free website on Tripod.com
Search:
Keywords:
In Association with Amazon.com

Locating Files and Directories

There will be times when you know a file or directory exists but you won't know where to find it. Searching for a file or directory can be easier with the locate command.

With locate, you'll see every related file or directory that matches our search criterion. Let's say you want to search for all files related to the finger command (finger tells you who is using your computer).

locate finger

The locate command uses a database to check for files and directories that match the string finger.

Tip

More About Locate

 

To learn more about locate, read the locate man page (type man locate at a shell prompt).

The locate command that works very quickly, as long as the database is up to date. That database is automatically updated on a nightly basis, from cron. Cron is a small program that runs in the background, performing various tasks, such as updating the locate database, at regularly scheduled intervals.

Tip

More About Cron

 

cron is a daemon that executes tasks at regularly scheduled intervals. Daemons handle tasks in the background. To read the cron man page, type man cron at the shell prompt.

If you have more than one operating system on your machine and switch between them (causing Red Hat Linux to halt and restart), or if you shutdown your machine at the end of the day, cron rarely has a chance to update the slocate database, which is used to catalog file location.

To update the database manually, log in as root (type su at a shell prompt and then your root password), and then type updatedb.

updatedb

After a few minutes, the slocate database will be current.

Note

Update Automatically with Anacron

 

You can run anacron to have your system execute commands periodically, with a frequency specified in days. Unlike cron, it does not assume that the machine is running continuously. Hence, it can be used on machines that aren't running 24 hours a day, to control daily, weekly, and monthly jobs that are usually controlled by cron.

Read the man or info page on anacron (type man anacron or info anacron at the command line) for more information.

Book Site Map ElectronicVideo

Amazon.com International Sites :

USA, United Kingdom, Germany, France