Datasheet
682
UNIX Commands 101
 The cd command stands for change directory.
cd /Desktop Folder
The result is an error message:
-bash: cd: /Desktop: No such file or directory
The problem is that a space character isn’t allowed in a path. To get around 
this problem, simply enclose the path in double quotation marks, like this:
cd “/Desktop Folder”
Mac OS X lets you use either double or single quotation marks to enclose 
a path with spaces in it. Standard UNIX operating systems, however, use 
double quotation marks for this purpose.
In a similar vein, you can get the space character to be accepted by a com-
mand by adding an escape character. To escape a character, add a backslash 
(\) immediately prior to the character in question. To illustrate, try the last 
command with an escape character instead. Note that this time, no quota-
tion marks are necessary.
cd /Desktop\ Folder
  You can use either quotation marks or escape characters because they’re 
interchangeable.
Help is on the way!
By now, you might be wondering how a computer techno-wizard is supposed 
to keep all these commands straight. Fortunately, you can find generous 
documentation for nearly every command available to you. To access this 
built-in help, use the man command. Using the man command (shorthand for 
manual) will display a help file for any command that it knows about. For 
example, to read the available help information for the ls command, simply 
type man ls at the prompt. Figure 1-3 illustrates the result.
Autocompletion
To speed things along, the bash shell can automagically complete your input 
for you while you type. (A shell takes the commands you type and submits 
them to the operating system, which then performs the tasks.) Although the 
Terminal permits you to enter commands via the keyboard, it is the shell that 
interprets those commands. Many kinds of shells are available to UNIX users. 
The shell that Lion uses by default is bash — another common shell is tcsh. 
Use the autocompletion features of bash to autocomplete both commands 
and filenames. To demonstrate, begin by typing the following:
cd ~/De
55_9781118022061-bk08ch01.indd 68255_9781118022061-bk08ch01.indd 682 8/10/11 9:39 AM8/10/11 9:39 AM










