open -- open files and directories

open [-e| -t] [-f] [-F] [-W] [-R]
[-n] [-g] [-h hdr]
[-b bundle_identifier]
[-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:
open *.doc

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.

-a application
--args All remaining arguments are passed to the opened application in the argv parameter to main(). These arguments are not opened or
-e open with /Applications/TextEdit
-t open with the default text editor, as determined via LaunchServices
-f Reads input from standard input and opens the results in the default text editor. End input by sending EOF character (^D). useful for piping output to open and having it open in the default text editor.
-F Opens the application "fresh," without restoring windows. Saved persistent state is lost, except for Untitled documents.
-n Open a new instance of the application(s) even if one is already running.
-W wait until the applications (or that were already open) have exited.
Use with -n flag to allow open to function as an appropriate app for the $EDITOR environment variable.
-R Reveals the file(s) in the Finder
-g Do not bring the application to the foreground.
-h Searches header locations for a header whose name matches the given string and then opens it.
Pass a full header name (such as NSView.h) for increased performance. interpreted by the open tool.
-b bundle_ID


Open file in the default application for its type (as determined by LaunchServices). open '/Volumes/DATA/food.jpg'

open home directory in the Finder: open ~

Open file in the application specified: open -a .bin/ food.txt

Open file using the bundle . open -b '/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

Open file in the default application for its type (as determined by LaunchServices).
open 'file://localhost/Volumes/DATA/food.txt'

Open a directory in the Finder: open 'file://localhost/Volumes/DATA/Applications/'

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
in Xcode: open -a Xcode -h NSString.h