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 *.docApplications inherit environment variables as if launched directly through its full path.
-a application | Application to open the file | ||||||||||||||||||||
--args arg … |
open '/Volumes/DATA/food.jpg'
home directory in the Finder: open ~
With a specific application : open -a .bin/MacVimPreview.app food.txt
using the bundle : open -b com.apple.TextEdit '/Volumes/DATA/food.txt'"
open -b com.apple.preview 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 http://www.apple.com/
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