open files or directory from OS X terminal

Terminal loves Finder
Terminal loves Finder

In Mac OS X Terminal open the current folder in Finder by using the command ‘open .’ You can also open a file with its default application by using ‘open fileName.fileExtension’


If the current working directory in terminal is “/System/Library” then ‘open .’ would open “/System/Library” in finder.

‘open test.txt’ would open the text file “test.txt” in TextEdit.

‘open *’ would open all the files in the current directory with their default applications.

‘open *.jpg’ opens all jpg images in folder.

‘open [ABC]*.pdf’ opens all pdfs that start with an uppercase A, B, or C.

The possibilities and the power of the ‘open’ command in terminal are astounding. Learn even more about the command by using the command ‘man open’ or just ‘open’ and the terminal will display more information on that command and how it is used. If you use the ‘man open’ command spacebar will show the next page and ‘q’ will exit the manual.

The heart in the image was acquired from under the Creative Commons Attribution 2.5 Generic License

URL: Accessed: 2009-4-24. (Archived by WebCite® at

Creative Commons License
Open files or directory in Finder from OS X Terminal by Mike Grace is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

Published by


I am a Geek! I hope you enjoyed this recent post.

4 thoughts on “open files or directory from OS X terminal”

  1. Great post and very useful! Another command that is useful and goes along with the article is the pwd command. It will tell you where you are so you will know what location you’re going to open. Also on the flip side, you can drag the icon in the window title bar that represents itself and drag it into the terminal window, which will give you a path to the dragged in item.

  2. Thanks Kyle,
    I plan on doing a more in depth look at the power of using the terminal in combination with the finder to get things done more effectively. I will be including many things similar to what you have suggested with dragging a folder from the finder into the terminal to have it input into the terminal the path of the file. Thanks for the comment and tips.

Comments are closed.