Skip to Content

Monday man page: open

Just a quick hint for today's man page: the open command does just what you might think. It opens files, directories, applications or URLs; no muss, no fuss. For files, you can specify an application to open them with the -a flag (or just trust LaunchServices to pick the right app). If you want to, the -e flag will force them to open in TextEdit.

open ~/Desktop/MyWordDoc.doc [will open in MS Word]
open -e ~/Desktop/MyWordDoc.doc [will open in TextEdit]
open ~/Desktop/*.doc [opens every Word document on the desktop, in Word]
open http://tuaw.com [well, give it a go!]


I use open in installation scripts or other situations where I want a GUI application to come up at the end of a process. For example,

open /System/Library/CoreServices/Software\ Update.app/

launches Software Update and begins checking for available patches. Sure, you can force an update with 'softwareupdate -i -a' anytime, but maybe I want to give the person sitting at the console an opportunity to select the updates needed, or cancel out of the possibly-lengthy update cycle until it's more convenient. You could also use the URL functionality to take people to a 'readme' website... the possibilities are manifold.

Categories

UNIX / BSD TUAW Tips

Just a quick hint for today's man page: the open command does just what you might think. It opens files, directories, applications or URLs;...
 

Add a Comment

*0 / 3000 Character Maximum

5 Comments

Filter by:
claytron

@2

instead of doing

open -a SubEthaEdit mytextfile.txt

you can use the 'see' command from SubEthaEdit (Installable via prefs -> advanced in SubEthaEdit)

see mytextfile.txt

I know this is about using open but see is nice too! Similar command line tool for TextMate too, 'mate'.

February 12 2007 at 8:57 PM Report abuse rate up rate down Reply
starwxrwx

I'm looking for a way to open iTunes remotely - ie, I log into my machine via ssh and want to start iTunes. But if I try to use open obviously it can't access the display where I am and refuses to open - but I want it to open on the local machine so I can get to my Tunes via Sharing - any ideas??

February 12 2007 at 7:34 PM Report abuse rate up rate down Reply
Michael Rose

Thanks Tom & Tim -- much appreciated.

February 12 2007 at 5:07 PM Report abuse rate up rate down Reply
Tom Robinson

"open" is one of the commands I miss most when I'm using an OS other than Mac OS X, although there's probably something similar.

Anyway, other good uses:

open -a SubEthaEdit mytextfile.txt

(opens mytextfile.txt in SubEthaEdit, replace SubEthaEdit with application of choice)

open .

(yes that's a period, opens a new Finder window with your current directory...basically the opposite of dragging a file or folder to the Terminal to get the path)

open -a TextMate .

(we can combine the previous two examples: if your app, TextMate in this case, can open a folder for browsing this will open the current directory in that app)

February 12 2007 at 3:27 PM Report abuse rate up rate down Reply
tim

these are great posts, mike! im glad you are here!

after mac addict turned to mac|life, i lost most of my every day mac stuff that has at least some 'power user' tips. nice to see you are keeping it alive.

February 12 2007 at 2:22 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.