O'Reilly logo

Learning Unix for Mac OS X Tiger by Dave Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Launching GUI Applications

One great feature of Mac OS X's Unix command line is that you can interact with the graphical applications in Aqua. For example:

  • Drag a file or folder from the Finder onto a Terminal window and watch as its full pathname gets dropped in after the command prompt.

  • Want to use vito edit a text file that's on your Desktop? Just type vion the command line, followed by a space, and then drag the file onto the Terminal window.

  • When viewing a file in the Finder, you'll see what's known as a proxy icon in the Finder's titlebar that shows you what directory you're in. Type cdfollowed by a space, then drag the proxy icon into the Terminal window and hit Return; you'll be taken to that same exact location, just in the Terminal.

If you can have the Finder interact with Terminal, it should be no surprise to you that you can also have Terminal interact with other graphical applications on the Mac. For this, Mac OS X offers the opencommand.

open

By default, the opencommand works identically to double-clicking an icon in the Finder. To open up a picture file in your default picture editor, use:

$ open peanut.jpg
$

If you don't have a graphic-editing application like Photoshop installed, the image opens in Preview (/Applications). If Preview is already running, the peanut.jpgimage file opens in a new window.

The opencommand also lets you work at the command line with file matching since it accepts more than one filename at a time. For example, if you need to open up a bunch of Microsoft ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required