Launch Applications from Terminal

Tue, Apr 15

When working inside a terminal window, there’s a quick shortcut you can use to open a file (read, launch an application on a specific file or set of files). The beauty of this trick is that the command will work as if you clicked on an application icon(s) in Finder. For example, if you request to open a file with an extension of xml, the application associated with that extension will be started and the specified file will be passed to the application.

The command I am referring to is open; read on to see a few examples:

From a terminal window, to all the files with a “.rb” extension (in the current directory):

> open *.rb

To launch a browser at a specified URL, try this:

> open http://macDeveloperTips.com

And to open Finder in the current directory:

> open .

You can get more information about using the open command by viewing the manual page:

> man open

One comment

THX!

by powerpawn on Dec 7, 2011. Reply #

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>