Terminal 101: Using the Find Command

Every Monday, we'll show you how to do something new and simple with Apple's built-in command line application.

Every Monday, we'll show you how to do something new and simple with Apple's built-in command line application. You don't need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type 'em out!

Finding files and folders on the Mac became easier when Spotlight was introduced in OS X Tiger (10.4), but locating files through the command line can be a bit tricker. Fortunately, the find command is tailor made for tracking down files and folders on your system. You can even search for certain file types, allowing you to find HTML, Text, and other documents that you may have misplaced.

Continue reading to learn all about the find command and how you can put it to use in your own workflow.

Basic Search

To begin searching for files, open the Terminal app, and then use the following command, followed by the enter key:

find X -name "Y"


Replace X with the path to the location on your computer that you wish to search. If you wish to search your entire computer, type “/” or if you wish to search only your user directory, type " /" there. Replace the Y (in quotes) with the search criteria.



The output of the command that is printed to the screen will be the directory paths to the files matching the search criteria. Return to the prompt without any printed results means that there was no file matching your specified criteria.

File Type Search

You can also search only for certain filetypes using a wildcard character (an asterisk, *). Type in the following command to search your user directory for all of the “.jpg” file types:

find / -iname "*.jpg"


Here, we use “-iname” instead of "-name”, and then we specify the file type (.jpg) with a wildcard in front of it. The wildcard means that anything can match the criteria, as long as it has the specified file extension. This will work with just about any file extension.



After running the command, the results that are printed to the screen are all of the jpeg pictures contained in our user home directory.


Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article's author, Cory Bohon on Twitter.