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.
Share
Categories
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
@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'.
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 Permalink rate up rate down ReplyThanks Tom & Tim -- much appreciated.
February 12 2007 at 5:07 PM Report abuse Permalink rate up rate down Reply"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)
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.
Hot Apps on TUAW
Deals of the Day
more deals- Refurb Apple MacBook Air Laptops: 12" 64GB SSD for $699 + free shipping
- JVC Motion Sensing Clock Radio with Dual iPod Docks for $55 + free shipping
- Apple iPhone Headset with Mic for $4 + $2 s&h
- miFrame Picture Frame Dock for iPad for $64 + $8 s&h
- Refurb Apple iPod nano 8GB MP3 Player for $99 + free shipping, 16GB for $119
- Hannspree Apple-Shaped 28" 1080p LCD HDTV for $270 + free shipping
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



5 Comments