Datasheet

Book VIII
Chapter 1
. . . And UNIX
Lurks Beneath
647
Working with Files
Leopard uses by default is bash — another common shell is tcsh. Use the
autocompletion features of bash to autocomplete both commands and file-
names. To demonstrate, begin by typing the following:
cd ~/De
Then press the Tab key. The result is that the shell predicts that you will
want to type
cd ~/Desktop/
Of course, if you have another folder that begins with the letters De in the
same folder, you might need to type a few additional characters. This gives
the autocompletion feature more information to help it decide which
characters you want to type. In other words, if you don’t type enough
characters, autocompletion ends up like a detective without enough clues
to figure things out.
Working with Files
If you’ve used a computer for any time at all, you’re no doubt familiar with
the idea of files. Even before the first floppy drive appeared in personal
computers, operating systems have stored data in files . . . they date back to
the days when a mainframe computer occupied an entire floor of an office
building. Mac OS X is no exception, and it’s important to understand how
Mac OS X arranges them into folders and how you go about accessing them
via the command line. This section describes the basic file and folder
information that you need to know to tame the beast that is UNIX.
Paths
Before you dive into UNIX commands, you should first know a few facts . . .
nasty things, facts, but you can’t earn your pair of techno-wizard suspenders
without ’em. For starters, as a Mac user, you might not be familiar with how
paths work in UNIX. A path is simply a textual representation of a folder or
file. The simplest path is your Home directory, which is denoted by a tilde
character (~) — the tilde character acts as the equivalent of /Users/<your
short account name> (in my case, /Users/markchambers). Any folder
within the Home directory is represented by the folder’s name preceded by
a forward slash (/). For example, a document entitled myDoc that resides in
the current user’s Documents folder would have a path like this:
~/Documents/myDoc
54_435410-bk08ch01.indd 64754_435410-bk08ch01.indd 647 8/6/09 12:44:59 AM8/6/09 12:44:59 AM