brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: open -R reveals a file in Finder instead of opening it

Finder
~/tips/tip-macos-open-reveal

open -R ~/Downloads/report.pdf

Shows a file selected in Finder instead of opening it.

You are in the terminal, you found the file, and now you want it in Finder to drag it somewhere.

Plain open opens the file in its default app. Add -R and it reveals the file in Finder instead.

open -R ~/Downloads/report.pdf

Finder comes to the front with the file selected, ready for drag and drop, Get Info or a share sheet. Without arguments you can still do open . to show the current folder.

The same command has more tricks from its man page. -a picks the application, -e forces TextEdit, -t uses the default text editor, and -n opens a new instance of an app even when one is already running.

open -a TextEdit notes.txt

The caveat is only the path. Relative paths work, but a typo gives an error and not a Finder window, so tab completion is your friend.

The nice part is the round trip: find the file on the command line, reveal it in Finder, do the visual part there, go back. Mixing the two is faster than forcing one tool to do everything.

Further reading: open.1 man page, On this site: Shift-Command-G opens a path in any Finder window, On this site: show the path bar in Finder with Option-Command-P

More Finder tips Option-Command-Y Quick Actions in the Finder preview pane rotate images and make PDFs Shift-Command-P show or hide the Preview pane Command-Up Arrow open the enclosing folder click the Trash in the Dock All Finder tips (37) All topics

Link