• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Finding Files Using locate and find

Finding Files Using locate and find

You can use both the find and locate commands in the Terminal to search the file system for files matching certain criteria. The locate command uses a database describing the known files on your system. The locate database is built and updated automatically as long as your system is running at the appropriate time. By default on Mac OS X and Mac OS X Server systems, the locate database is updated at 4:30 A.M. each Saturday. You can execute the script that updates the locate database using the command sudo /etc/weekly.

The locate command understands the wildcard characters used by the shell (wildcards are discussed later in this appendix). In order to pass the wildcard character on to the locate command, you must escape the character so that the shell doesn't process it. For example, the command locate "*.rtf" or locate \*.rtf will print a list of all files with names ending in .rtf, while locate *.rtf results in an error.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint