The locate utility is part of the findutils-locate package. Before you can use locate,
you must use YaST to install this package on your system, as shown in Figure 18.6.
FIGURE 18.6 Installing locate packages.
After these packages are installed, a database is created in /var/lib called locatedb. A
listing of files in your file system is stored in this database. This database is automatically
updated every day. If necessary, you can also manually update it by running the updatedb
utility from the shell prompt.
With the database updated, you can use the locate utility to search for files within it. The
syntax for using locate is relatively simple. You simply run locate and specify the name
of the file you want to search for, as shown next:
locate file_name
For example, if you wanted to search for the myfiles file, you would enter locate
myfile, as shown in Figure 18.7.
Finding Files 389
18
FIGURE 18.7 Using locate to find files.
As with find, you can view the man page for the locate utility to learn more.
In addition to find and locate, you can also use the which command to search for files.
Pages:
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796