open [-e| -t] [-f] [-F] [-W] [-R]
[-n] [-g] [-h hdr]
[-a application] file … [--args arg1 … ]
Opens a file (or a directory or URL), just as if you had double-clicked the file's icon.
If no application name is specified, the default application as determined via LaunchServices is used to open the specified files.
If the file is in the form of a URL, the file will be opened as a URL.
You can specify one or more file names (or pathnames), which are interpreted relative to the shell or Terminal window's current working
directory. For example, the following command would open all Word files in the current working directory:
Opened applications inherit environment variables just as if you had launched the application directly through its full path. This behavior was also present in Tiger.
open home directory in the Finder:
Open file in the application specified:
open -a .bin/MacVimPreview.app food.txt
Open file using the bundle .
open -b com.apple.TextEdit '/Volumes/DATA/food.txt'"
Open file in TextEdit.
open -e '/Volumes/DATA/foo.txt'"
Write output of the 'ls' command to a file in /tmp and
opens the file in the default text editor (as determined by LaunchServices).
ls | open -f
Open URL in the default browser.
Open file in the default application for its type (as determined by LaunchServices).
Open a directory in the Finder:
List headers whose names contain NSView and allows you to choose which ones to open:
open -h NSView
Quickly open /System/Library/Frameworks/Foundation.framework/Headers/NSString.h
open -a Xcode -h NSString.h