Open any folder from the Terminal app in a Finder on macOS

Published on Jul 21, 2022

2 min read

TOOLS

Often, I struggle or want to open the current directory I am working from the Terminal app to the Finder window on macOS.

I have been a macOS user for almost eight years now, and it never occurred to me that I couldn't open the current location from the Terminal app. Until recently, a frustration point led me to find the solution. Again, though, I am surprised by its simplicity.

To open the current working directory in the Finder window, use the following command:

open .

The open command opens a file or a folder. It exists on the macOS.

You can do more with this command. The / argument opens the root directory.

open /

A specific directory is also allowed:

open ~/Desktop

Using the option R, you can locate a specific file or folder in the Finder:

open -R /blog

Opening files

🔗

There are more things that the open command can do. It can open files. For example, to open a markdown file in the default editor or IDE:

open ./blog/mm-yy/your-file-name.md

The above command opens the markdown file in the Xcode. You can pass the -t option to open in the file in a text editor.

open ./blog/mm-yy/your-file-name.md

Opening URLs

🔗

It can do more than open files and folders. It can also open a URL in the default web browser set up on your machine:

open https://www.google.com

Use the option a to override the default web browser and specify a different one.

open -a Safari https://www.google.com

More Posts

Browse all posts

Join 1300+ devs & subscribe to my newsletter!

NEWSLETTER

🔗 Subscribe on Revue

Aman Mittal author

Software Developer and Technical Writer since 2017. Loves learning and writing about Node.js, React, React Native & Expo. Previously, worked as Developer Advocate, independent consultant, and technical writer with companies like Draftbit, Vercel and Crowdbotics.


Copyright ©  2019-2022 Aman Mittal · All Rights Reserved.