Apple - How Can I Search A Specific Type of File in Mac?

Search by Kind One of the most useful ways to narrow down a search is by using the kind: keyword. This allows you to restrict your list of results to a certain file format. For instance, if you type time machine kind:pdf, Spotlight will pull up only PDF files containing the words "time" and "machine". You can also limit your search to e-mail messages, music files, System Preferences, applications, and more.

While the original Spotlight recognized only a limited number of file types, the Leopard version can look for files created by specific applications, as well as certain file formats. Searching for kind:mp3 or kind:tiff will find files in one of those formats, and searching for kind:pages or kind:powerpoint will show only documents created in one of those programs. For a list of useful keywords, see “My Kind of Keyword.” But remember, for the keywords to work, you must have the appropriate categories enabled in Spotlight’s preferences.

you can get more info here or here.

alt text


It's already been answered, but here's my 2 cents.

Via Bash through the terminal

find ~ -type f -name '*pdf' or find ~ -iname '*pdf'

(or, if you want to ignore error messages, find ~ -type f -name '*pdf' 2>/dev/null)

or you can use this to search for a string in a file:

find ~ -iname '*txt' | xargs grep 'string you want'

This may not return anything on a pdf, but it will work on most other file types (text, php, py, html, etc).


To the best of my knowledge it's not possible via spotlight (tested on Mojave). You can only use finder:

  1. Start a search with Command+F.
  2. Click on the '+' icon on the far side of the taskbar
  3. Select the type from the 'kind' pull-down menu. Select 'other' and then find 'File extension'

Enter your desired file extension and hit enter.