locate command.
With locate, you will see every file or directory whose name contains the search criterion. For example, if you want to search for all files with the word finger in the name, type:
locate finger |
The locate command uses a database to locate files and directories that have the word finger in the file or directory name. The search results could include a file called finger.txt, a file called pointerfinger.txt, a directory named fingerthumbnails, and so on. To learn more about locate, read the locate man page (type man locate at a shell prompt).
The locate command works very quickly, as long as the database is up to date. That database is automatically updated on a nightly basis through a cron job. cron is a small program that runs in the background, performing various tasks (such as updating the locate database) at regularly scheduled intervals.
![]() | Tip |
|---|---|
Cron is a daemon that executes tasks at regularly scheduled intervals. To read the cron man page, type man cron at the shell prompt. Refer to the Red Hat Linux Customization Guide for more information on cron. |
The cron task periodically updates the slocate cron.
To update the database manually, log in as root (type su at a shell prompt and then your root password) and type the command updatedb.
After a few minutes, the slocate database that is used by the locate command will be current.
![]() | Note |
|---|---|
You can run anacron to have your system execute commands periodically, with a frequency specified in days. Unlike cron by cron. Refer to the man page on anacron (type man anacron at the command line) and the Red Hat Linux Customization Guide for more information. |
| Главная |