Latest in Cli

Image credit:

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 [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\

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.

From around the web

ear iconeye icontext filevr