man open on macOS is super interesting. I have used open -a to launch specific apps for years, but I have never looked at all the other options. There are many, and they are pretty cool! Here are just a few of the neat things you can do:
-
open -eopens the item in TextEdit. I basically never want this, and it’s fascinating that it’s built in. -
open -topens in your default text editor — for me it’s BBEdit; but whatever you have configured will do. Note: this is not$EDITORbut LaunchServices: a macOS-ism. -
open -Fopens a “fresh” version of the app, not doing window or document restoration. Handy if it’s borked! -
open -Rreveals it in the Finder instead of opening it. -
open -freads input from stdin and opens the results in your text editor (weird but… cool, I think).
There are a bunch of other neat little details like this. I never would have learned them if I had not taken the time to man open and learn a bit more about this tool. Now it’s a more useful tool in my toolbelt!
I am going to try to make a habit of doing these man page samplers every Thursday. They will be on both social media and on my website. Follow me wherever is convenient to see when I post them!