Datasheet

Book VIII
Chapter 1
. . . And UNIX Lurks
Beneath
675
Why Use the Keyboard?
For example, consider how many times you’d have to click a mouse in the
Finder to do the following:
1. Find all files that begin with the letters MyDocument.
2. From this list of files, add a number to the beginning of the filename,
indicating its size in kilobytes.
3. Save the names of all altered files to a text file.
By using the command line, you could accomplish all these tasks by typing
only one super-command: that is, a collection of three simple commands
combined to form one instruction. The built-in Terminal program that ships
with Mac OS X Lion gives you everything that you need to start using the
command line. I show you how in the section “Uncovering the Terminal,”
later in this chapter.
Delving further into super-commands isn’t for the faint-hearted; things get
pretty ugly pretty quickly, and this chapter can only show you the very
beginning of the UNIX Yellow Brick Road. Therefore, if your thirst for UNIX
dominance so compels you, I invite you to do a little independent study
to bone up on the operating system. Pick up a copy of the great book of
lore entitled UNIX For Dummies, 5th Edition, written by John R. Levine and
Margaret Levine Young (Wiley).
Go where no mouse has gone before
The Finder is generally a helpful thing, but it makes many assumptions about
how you work. One of these assumptions is that you don’t have any need to
handle some of the files on your hard drive. As I mention in Book II, Chapter
6, Mac OS X ships with its system files marked Off Limits, and I generally
agree with that policy (which keeps anyone from screwing up the delicate
innards of Mac OS X). To secure your system files, Apple purposely hides
some files from view.
But what road do you take if you actually need to view or modify those
system files? Yep, you guessed it: The command line comes to the rescue!
You can use the command line to peer inside every nook and cranny of your
Mac’s vast directory structure on your hard drive. It also has the power to
edit files that aren’t normally accessible to you. With the command line, you
can pretend to be other users — even users with more permissions. By tem-
porarily acting as another more powerful user, you can perform actions with
the command line that would be impossible in the Finder. (Just remember to
make sure that you know exactly what you’re doing, or you’re working with
an Apple technical support person — a wrong move, and it’ll be time for an
Ominous Chord.)
55_9781118022061-bk08ch01.indd 67555_9781118022061-bk08ch01.indd 675 8/10/11 9:39 AM8/10/11 9:39 AM