You’d like to be able to find files without having to wait for a long find command to complete, or you need to find a file with some specific content.
If your system has locate, slocate, Beagle, Spotlight or some other indexer, you are already set.
If not, look into them.
The location of the actual database files, what is indexed therein, and how often, may vary from system to system.
Consult your system’s manpages for details.
1 2 3 4 5 6 7 |
$ locate apropos /usr/bin/apropos /usr/share/man/de/man1/apropos.1.gz /usr/share/man/es/man1/apropos.1.gz /usr/share/man/it/man1/apropos.1.gz /usr/share/man/ja/man1/apropos.1.gz /usr/share/man/man1/apropos.1.gz |
locate and slocate don’t index content though, so see Recipe 9.9, “Finding Files by Content” for that.
Beagle and Spotlight are examples of a fairly recent technology known as desktop search engines or indexers.
Google Desktop Search and Copernic Desktop Search are two examples from the Microsoft Windows world.
Desktop search tools use some kind of indexer to crawl, parse, and index the names and contents of all of the files (and usually email messages) in your personal file space; i.e., your home directory on
a Unix or Linux system.
This information is then almost instantly available to you when you look for it.
These tools are usually very configurable, graphical, operate on a per-user basis, and index the contents of your files.
slocate stores permission information (in addition to filenames and paths) so that it will not list programs to which the user does not have access.
On most Linux systems locate is a symbolic link to slocate; other systems may have separate programs, or may not have slocate at all.
Both of these are command-line tools that crawl and index the entire filesystem, more or less, but they only contain filenames and locations.