Terminal 101: Using Man Pages

Every Monday, we’ll show you how to do something new and simple with Apple’s built-in command line application. You don’t need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type ’em out!

Know of a great command line command, but don’t know all of its features or how to use it? If only you had a way to display a manual for the command. Well, as it turns out, there’s a command for just that. Enter “man” (short for manual). Using this command, you can see the command and all of its parameters that can be used with it. Continue reading, and we’ll show you how to take advantage of this built-in guide.

Viewing man pages

Man pages are essentially built-in guides that are included with commands built into the system, and even packages downloaded and installed from Homebrew and MacPorts. These manual pages can be viewed by typing in the following command:

man commandName

Replace “commandName” in the above command with the CLI (command line interface) command that you wish to read more about. For instance, if you wanted to view the manual page for the man command (yes, that exists), you can use the following command:

man man

After pressing enter, the man page for the command will instantly load, allowing you to see all of the documentation (available flags and their meaning, and other information the developers included).


Navigating through the manual is easy: Simply use the keyboard’s space bar to jump down a page in a longer document; or, you can also use the up and down arrow keys on your keyboard to move through the document.

Searching through the manual

To search for a specific word in the document, simply load up the manual page that you wish to search through, and then use the following shortcut:

/searchterm

Replace “searchterm” with the term that you wish to search for in the man page. After pressing enter, all of the words in the document matching the search term will be highlighted, and you will be taken to the first match in the document. To go to the next word matching the search term, simply type a forward slash (/) followed by the enter key.

Quitting

To exit the manual page, simply press the “q” key on your keyboard. The page will close, and you will instantly be taken to back to the command line interface.

Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article’s author on Twitter.