ls
or cd
? Is it some kind of arcane knowledge, handed down only to initiates after grueling initiations? Well, no. Actually, anyone can learn about Terminal commands, if they know where to look. Today, I’ll tell you where.man
command. It summons manual (or man) pages for almost any command; they’re the equivalent of a help system for the command line. In fact, man
itself is a command, whose role is to format and display this documentation.man pwd
, for example, Terminal will display the man page for the pwd
command.man
pages have a common format. They begin with name (the name of the command) and a brief description of what it does. The pwd
command I looked at above shows the following:pwd—return working directory name
pwd
, there are two options: -L
and -P
. These options are explained in the description section:-L
option is desired if no other option (and there’s only one) is specified.man
pages also contain examples to help you understand them.man
page, you do so in Terminal through another command, called a pager; by default, this is the less
command. What a pager does is allow you to view content in Terminal page by page, or line by line. When you’re viewing a man
page, you will most often not see the entire page at once. You’ll need to page down to see more.less
. If you press Return, the page will move down one line. And if you press the spacebar, the page will scroll one page (the number of lines visible in your Terminal window). You can tell that there’s more to come by the :
(colon) visible at the bottom of the window.man ls
, then press Return. The ls
command’s man
page is quite long, and you’ll need to press the spacebar several times to get to the bottom.man
page, you need to go back up and look at something that’s no longer visible. Depending on your Terminal settings, you may be able to scroll the Terminal window. If not, press Control-B to go back a page, and the spacebar, or Control-F, to go forward a page.man
page, you’ll see this: (END)
. You’ll notice that you can’t do anything at that point; you need to quit the less
command; do this by pressing the q
key.man
pages in Terminal, there are other ways to view this content. Carl Lindberg’s free ManOpen is a simple app that lets you view man
pages in a more attractive way than in Terminal. Press Command-O, enter the name of a command, and click Open. ManOpen is especially useful because you can choose specific sections to view from a popup menu, and you can navigate more easily than in Terminal with the less
command.man
pages on the Web. Just type man
and the name of a command into your favorite search engine, and you’ll get plenty of hits. Apple has a documentation repository with man
pages here. You can click Alphabetic Index to get a list of all commands, then search for the one you want. Apple’s man
pages are useful because a popup menu near the top of the page lets you choose an OS X version, so if you need to see the man
page for an older version of OS X, you can do so.man
pages open the door to a goldmine of information about the command line. Use them and you’ll learn all the ins and outs of the commands you use.