|
|
|||
LOCATING FILES If you
frequently search for files on your system, you can speed up searches
by using the locate command. In brief, the locate command creates
a database of filenames on your system. When you search for a file,
you search the database, not the file system. As a result, searches
proceed much more quickly. The down side is that the database won't
contain files you've created since the last time the database was
The original locate command displayed all the files throughout the system, including those that ordinary users were not authorized to see. For this reason, it has been replaced by the slocate command on most Linux distributions. The slocate command does not display files that the current user is not authorized to see.Some distributions include aliases that map the slocate command to locate. Check your distribution's documentation to find out whether slocate is available on your system and whether you access the command by typing locate or slocate. To create an slocate database beginning at the root directory, switch to superuser (type su and supply the root password), type slocate -u, and press [Enter]. To locate all of the files in the locate database that contain the characters "jpg," type locate jpg and press [Enter]. Note that it isn't necessary to use wildcards; by default, slocate performs a substring search. You can also type a complete filename. |
||||