August 31, 2014 | By More
Command Line Tools

If you are like me and you spend some time in terminal then this awesome command line tool can if use correctly save you a chunk of time.

Usage: open [-e] [-t] [-f] [-b ] [-a ] [filenames]
Help: Open opens files from a shell.
Help: Open opens files from a shell.
By default, opens each file using the default application for that file.
If the file is in the form of a URL, the file will be opened as a URL.
-a Opens with the specified application.
-b Opens with the specified application bundle identifier.
-e Opens with TextEdit.
-t Opens with default text editor.
-f Reads input from standard input and opens with TextEdit.
-g Does not bring the application to the foreground.
-R Selects in the Finder instead of opening.

To open a file simply type open -a ~/Desktop/text.txt. If you want to open this file in the background the simply type open -g ~/Desktop/text.txt. If textedit is your default editor then save yourself a little more time by using open -e ~/Desktop/text.txt again add the -g flag to open in the background. Now to open the file in your default editor as determind by LaunchServices use open -t ~/Desktop/text.txt.

To reveal the location of the file insted use the -R flag as in open -R ~/Desktop/text.txt This I find extremely helpful editing a file that has a long path. Of course you can edit files in VIM but thats for another day.

For more info type man open.

Category: OS X, Terminal

About the Author ()

Comments are closed.