Locating Lost Files with locate

If you’re looking for a system file—that is, a program or file that is part of the Unix system itself, rather than one of your personal files in your home directory—try locate to find it. You’ll get more results than you can handle, but it’s a quick and easy way to locate system files.

The locate command isn’t available on all Unix systems, but it is worth a try at any rate. See Code Listing 2.13 for locate in action.

Code Listing 2.13. Use locate to find everything— everything—related to most system files.
[jdoe@frazz jdoe]$ locate fortune /usr/share/man/man6/fortune.6.bz2 /usr/share/doc/fortune-mod-1.0 /usr/share/doc/fortune-mod-1.0/cs /usr/share/doc/fortune-mod-1.0/cs/ → HISTORIE /usr/share/doc/fortune-mod-1.0/cs/LICENSE ...

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.