Terminal Tips and Tricks
After you've used Terminal awhile, you may feel ready for a few of these power tips.
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.)
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.
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access