open files and directories

open [-e|-t] [-f] [-F] [-W] [-R] [-n] [-g] [-h hdr] [-b bundle_identifier] [-a application] file[--args arg]

Opens a file (or a directory or URL), as if you had double-clicked the file's icon.

If application is not specified, the default application as determined via LaunchServices is used to open the files including searching $PATH.

file (or pathnames) are interpreted relative to current working directory .
For example, to open all Word (.doc) files in the current working directory:

 open *.doc
Applications inherit environment variables as if launched directly through its full path.

-a application Application to open the file
--args arg remaining arguments are passed to the application without being opened or examined.
-e open with 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 file in Finder
-g Do not bring the application to the foreground.
-h header.h Searches header locations for a header then opens it with Xcode.
Pass a full header name (such as ./hdrlib/NSView.h) to supress the search. interpreted by the open tool.
open -h CIImage
Warning: Xcode platforms folder not found at "/Library/Developer/CommandLineTools". 
You may have invalid DEVELOPER_DIR or stale xcode-select setting.
[0] cancel
[1] all

[2] /System/Library/Frameworks/CoreImage.framework/Headers/CIImageAccumulator.h
[3] /System/Library/Frameworks/CoreImage.framework/Headers/CIImageProcessor.h
[4] /System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h
[5] /System/Library/Frameworks/CoreImage.framework/Headers/CIImageProvider.h

Which header(s) for "CIImage"? 
-b bundle_ID


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

home directory in the Finder: open ~

With a specific application : open -a .bin/ food.txt

using the bundle : open -b '/Volumes/DATA/food.txt'"

open -b file:///Volumes/DATA/dgerman/Documents/computerstuff/phyweb/Nordic/nRF52832-memory.html

With TextEdit. open -e /Volumes/DATA/foo.txt

pipe output of 'ls' to the default text editor : ls | open -f .

URL in the default browser.: open

With 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

open /System/Library/Frameworks/Foundation.framework/Headers/NSString.h in Xcode: open -a Xcode -h NSString.h