We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Man

The man command is short for "manual." It's a program that displays the manual for other programs.

A 3000-year-old photo of Moses instructing his people to "read the f---ing friendly manual"

I know that manuals and documentation can feel intimidating, heck, that's why there are courses like this one to give you a gentler introduction. That said, manuals and documentation will become more useful to you as you become a more experienced developer. They're not as scary as they seem when you actually take the time to read them.

Using man

The man command will only work for programs that it has a manual for, but most built-in commands and Unix programs are supported. You just pass the name of the command as an argument. The most intuitive place to start, of course, is reading the manual's manual:

# open the man pages for the 'man' command
man man

Searching

Most people don't just read man pages for fun. More often, the manual is used as a reference to quickly look up usage or special flags.

You can search for text in the manual by pressing the / key and typing your search, then pressing enter. Let's try to look up what the -r flag does for the ls command:

man ls
# type '/-r' to start searching

# press 'n' to jump to the next result

# press 'N' to go back if you went too far

Assignment

As a systems person, the grep command will be your best friend. It has a lot of power, but it can be a little confusing to use.

  1. Open the grep manual.
  2. You'll notice that the manual is an interactive session. Page through the manual with the spacebar, and quit with q.

Read the first couple paragraphs of the grep manual, then read the question and scroll through the rest of the manual for the answer.