open

Open a file or folder.
The open command opens a file (or a folder or URL), just as if you had double-clicked the file's icon.

Syntax
      open [-a application] file ...

      open [-e] file ...

Key
   -a     Specify the application to use for opening the file
   -e     Edit the file (with /Applications/TextEdit)

If no application name is specified, the default application as determined via LaunchServices is used to open the specified files.
You can specify one or more file names (or pathnames), which are interpreted relative to the shell or Terminal window's current working directory. e.g. open *.doc

Examples

Open the current terminal working directory
$ open .

Open demo.txt in the default application (as determined by LaunchServices).
$ open /Volumes/Macintosh HD/demo.txt
or
$ open file://localhost/Volumes/Macintosh HD/demo.txt

Open a folder in the Mac Finder.
$ open /Volumes/Macintosh HD/Applications/
or
$ open file://localhost/Volumes/Macintosh HD/Applications/

Open demo.txt with a specific application (in this case, TextEdit).
$ open -a /Applications/TextEdit.app /Volumes/Macintosh HD/demo.txt

Open a URL
$ open http://ss64.com/

Edit demo.txt (will open in TextEdit)
$ open -e /Volumes/Macintosh HD/foo.txt

“Clothes make the man. Naked people have little or no influence on society” ~ Mark Twain

Related:

open man page - Apple.com
lesskey -
echo - Display message on screen
tee - Redirect output to multiple files
The less home page (Mark Nudelman)
Article: TA24770 - Clear the Finder "Open With" contextual menu (rename /Library/Preferences/com.apple.LaunchServices.plist).


© Copyright SS64.com 1999-2014
Some rights reserved