16.6. Terminal Tips and Tricks
After you've used Terminal awhile, you may feel ready for a few of these power tips.
16.6.1. Switching Windows
You can switch among your various Terminal windows by pressing -1, -2, and
so on (up to -9). You'll be able to identify the windows easily if you choose to
include the Command key in the title bars. (Use the Window section of the Settings
Preference pane.)
16.6.2. Non-Contiguous Selection
You can select blobs of text, just as in Microsoft Word or TextEdit. To select a single
rectangle of text anywhere in the window, Option-drag through it. To select multiple
rectangles, -drag. You can then copy and paste just those selected blobs.
16.6.3. Double-Clickable Unix Tools
Most people are used to thinking of Unix applications as programs you run from within
Terminal. Many, though, appear in the Finder as regular old icons—and you can open
them by double-clicking, just as you would a traditional Mac OS X program. This trick
isn't very useful for commands that require flags. But for some, like cal, clicking provides
a quick way to run the program, especially if you keep it in your Dock.
To double-click a Unix program, though, you first have to find it—and that may not be
easy. Mac OS X's Unix directory structure is labyrinthine indeed.
But why not ask Terminal where the program is? You can do exactly that using the which
command: which cal, for example. Terminal responds with /usr/bin/cal, telling you that
cal resides in the /usr/bin directory.
To get there, use the open command in Terminal, like this: open /usr/bin. A window
opens in the Finder; inside, you'll find the cal icon. Drag the icon to the right side of the
Dock.
From now on, when you click that Dock icon, a new Terminal window opens,
automatically displaying this month's calendar. You've shaved several precious seconds
off the time it would have taken you to open iCal.