November 2012
Intermediate to advanced
424 pages
11h 59m
English
| Tip 327 | Search Spotlight from Terminal |
This is a tip for those who like to use the command-line prompt. To perform a Spotlight search at the command line, use the mdfind command. For example, to search for any documents that contain the term macintosh, you could type the following:
| | mdfind macintosh |
The -onlyin command option will limit the search to a certain folder, which is useful if you want to find files that are within your Documents folder, for example. The following would search for files containing the term macintosh within your Downloads folder:
| | mdfind -onlyin ~/Downloads macintosh |
An interesting additional command option is -count, which will display how many files there are that contain your search term, for example:
| | mdfind -count ... |
Read now
Unlock full access