Navigating in Unix

If you can’t see any icons for your files and folders, how are you supposed to work with them?

You have no choice but to ask Unix to tell you what folder you’re looking at (using the pwd command), what’s in it (using the ls command), and what folder you want to switch to (using the cd command), as described in the following pages.

pwd (print working directory, or “Where am I?”)

Here’s one of the most basic navigation commands: pwd, which stands for print working directory. The pwd command doesn’t actually print anything on your printer. Instead, the pwd command types out, on the screen, the path Unix thinks you’re in (the working directory).

Try typing pwd and pressing Enter. On the next line, Terminal may show you something like this:


Terminal is revealing the working directory’s path—a list of folders-in-folders, separated by slashes, that specifies a folder’s location on your hard drive. /Users/chris/Movies pinpoints the Movies folder in Chris’s Home folder (which, like all Home folders, is in the Users directory).


Capitalization counts in Unix. Command names are almost always all lowercase (like cal and pwd). But when you type the names of folders, be sure to capitalize correctly.

ls (list, or “What’s in here?”)

The ls command, short for list, makes Terminal type out the names of all the files and folders in the folder you’re in (that is, your working directory). You can try it right now: just type ls and then press Enter. Terminal responds by ...

Get Mac OS X: The Missing Manual, Tiger Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.