next up previous contents
Next: Finding files in your Up: Other useful commands Previous: Finding patterns in files   Contents

Locating files in the system

Use the command locate <substring> to find all files in the system whose names contains the string <substring>. An example: Suppose you want to find a file that has the string ``duck'' in its name. So you type in the following command and its output is shown below the command.

[amit@onyx]: locate duck
/usr/local/applix/axart/anml_out/duck_01.ag

The locate command accesses a database of names of all files on the system to perform the search. That makes it fast!

Note that if you provide a generic substring, then locate may find hundreds of files. In this case, it is handy to pipe the output to grep to filter out the results of interest. For example:

[amit@onyx amit]$ locate record | grep bin 
/usr/bin/cdrecord
/usr/bin/dvdrecord
/usr/bin/record
/usr/bin/na_record



Amit Jain 2009-08-23