When you start exploring the macOS Terminal, moving between folders with cd and listing files with ls is step one. But did you know that macOS has several built-in terminal superpowers designed specifically to bridge the Mac graphical desktop (Finder) with the command line?
Bridging Finder and Terminal
Think of your Mac as having two doors into the same house: Finder is the front glass door, and Terminal is the workshop side door. Instead of choosing one or the other, you can use them together smoothly.
Opening Finder from Terminal with 'open .'
Have you ever navigated deep into a project folder in Terminal and wished you could quickly see it in a standard Mac Finder window? Just run:
# Open the current terminal directory in a new Mac Finder window
open .The open command is unique to macOS. Passing a dot (.) tells it to launch Finder right at your current working location. You can also open any file with its default Mac app, like open notes.txt to view it in TextEdit or open image.png for Preview!
The Drag-and-Drop Path Trick
Typing long Mac file paths with spaces (like /Users/bagus/Documents/My Project Folder/) can lead to frustrating typing errors. Here is a favorite Mac developer trick:
- Type
cd(with a space) in Terminal. - Drag any folder from Finder and drop it directly onto the Terminal window.
- Terminal will automatically paste the complete, properly escaped file path!
Quickly Returning Home with cd ~
Whenever you feel lost deep inside system directories, you can return to your Mac home user folder with one keystroke:
# Jump straight back to /Users/yourusername/
cd ~
# Or simply type cd with no arguments!
cd3 Things to Remember
- 'open .' opens Finder: It is the fastest way to switch from the command line to a visual macOS Finder window.
- Drag and Drop Saves Time: Dragging any folder from Finder directly into the Terminal window pastes its exact path without typos.
- Tilde (~) is Home: The
~symbol always represents your personal user folder on macOS.