man opens the manual page for a command from /usr/share/man, right there in the terminal. No network, and no browser tab.
man -k found the page I could not name from its one-line description, and man -f listed two pages under the same name. The section number settles which one you get.
What man reads, and what a section is
A manual page is not a text file sitting on disk. The file is compressed roff source, and man formats it with groff the moment you ask, then hands the result to a pager.
man -w prints the file that would be shown instead of showing it. For the ls command that is /usr/share/man/man1/ls.1.gz, whose header line reads .TH LS "1" "August 2026" "GNU coreutils 9.4", which is why two machines with different coreutils print two slightly different pages for the same name.
The number in parentheses after a page name is its section, and one word can exist in several of them. Each number answers a different question about the same name, so the section you leave out decides what you get.
| Section | What it holds | A page in it |
|---|---|---|
| 1 | Executable programs and shell commands | man(1), ls(1) |
| 2 | System calls provided by the kernel | open(2) |
| 3 | Library calls inside program libraries | printf(3), crypt(3) |
| 4 | Special files, usually device nodes | null(4) |
| 5 | File formats and conventions | passwd(5), crypt(5) |
| 6 | Games | intro(6) |
| 7 | Miscellaneous, including macro packages | man(7), groff(7) |
| 8 | System administration commands, usually run as root | chpasswd(8) |
| 9 | Kernel routines, non standard | none installed by default |
man shows the first page it finds and stops, even when the name matches more than one section. The order comes from the man-db configuration and starts 1 n l 8 3 0 2 3type 5 4 9 6 7, so man printf lands on the shell command in section 1 rather than the C function in section 3.
I checked both pages under that name, and they share nothing beyond the word printf in their NAME lines.

Every page keeps that shape. The NAME line is the sentence man -k searches, the SYNOPSIS is the argument order the examples assume, and OPTIONS is where the flag you came for is listed.
The option set in this piece is the one the man-db project publishes on its man(1) page, which is the same text the local man prints.
What has to be on the system
A manual page is not always installed with the command it documents, and a small server build can carry ls without carrying the ls page. Which piece is missing decides which command fixes it.
| What has to be there | What breaks without it | How to check |
|---|---|---|
| man-db | man, apropos, whatis and mandb do not exist at all | command -v man |
| The page for that package | the command runs and man reports no entry for it | man -w ls |
| The index files | keyword search answers nothing appropriate | ls -l /var/cache/man/index.db |
| A pager such as less | the page prints once with no scrolling and no search | echo $PAGER |
| The groff package, not only groff-base | -Tpdf stops before it formats anything | command -v gropdf |
| A terminal width, or MANWIDTH | long lines wrap at whatever the window gives them | echo $MANWIDTH |
On a minimal Ubuntu image the missing pieces arrive together.
sudo apt install man-db
The first check I run is command -v man, because the rest of the table follows from it. The system call and library pages come from manpages and manpages-dev, so a section 2 or 3 lookup that returns nothing for a function the kernel implements means those two packages are absent.
Find the page you need
The commands that matter here split by what you already know. If you have the name, one opens the page, and if you only have the topic, another searches the descriptions.
A third command settles the case where one name points at several pages.
Open a page by name
man followed by the page name opens the pager at the top of the page. The -w flag stops before the pager and prints the file instead, which is the fastest way to find out whether a page exists.
man -w ls
That path tells you which section won and which package owns the page. It is the same route whereis takes when it prints a binary beside its page.
The -l flag reads a file you already have instead of looking a name up, which is how a page pulled from another machine gets rendered with the local formatter.
Search the descriptions with man -k
A keyword search reads the one-line descriptions rather than the names, so it reaches a page whose name you would never guess.
man -k crypt
Each line that comes back is a page mentioning the word in its description, with the section in parentheses. apropos is the same command under another name, so the flag and the standalone tool share one index.

Section filtering narrows the same search when you already know the kind of page you want. Apart from a shorter list, it keeps the library calls out of a search for a command.
man -k --sections=1 crypt
Each hit carries the section number that turns the name into an addressable page, so the list is usable as it stands.
I found the library call, the file format and the kernel documentation for crypt from that one word.
Decide between two pages with the same name
man -f prints every page whose name matches, one line each. Reach for it when a page describes something other than the command you type.
man -f printf; man -w -s 3 printf
The first line of that output is printf(1), the shell command, and the second is printf(3), the C function. Naming the section picks the file, which the second command proves by printing /usr/share/man/man3/printf.3.gz.

Show every page with that name
The -a flag walks the whole match list instead of stopping at the first page, and whatis answers the same question as man -f.
man -a open
That name opens two pages in sequence, the desktop launcher in section 1 and the system call in section 2. Press q to leave the first one and the second follows.
Read it without drowning in it
The pager owns everything between the page opening and the answer you came for, and on a stock install it is less. A short key list covers the whole job, and I reach for three of those keys.
| Key | What it does |
|---|---|
| /text | searches forward from the current line, and n jumps to the next match |
| g and G | jump to the top and the bottom of the page |
| Space and b | move one screen forward and one screen back |
| q | leaves the pager, and this is the key to remember |
| h | the pager key list, which man does not repeat |
The search is the one to learn first, because it works on every page you open, however long the page runs.
MANPAGER picks that program, and PAGER is the fallback when MANPAGER is unset. Setting the variable to cat makes the page print straight through, which is what the pipeline examples below do one command at a time.
Search a page from the shell
When the page has to be filtered rather than read, cat takes the pager out of the pipeline and grep does the matching.
man --pager=cat ls | grep -n -e '--sort'
Every line that mentions the flag comes back with a line number, so the option can be read where it sits. Reaching for the pipeline is worth it when the result feeds something else, and the search inside the pager is faster when you only want to read it.
A narrow terminal wraps the page at its own width. MANWIDTH overrides that width without resizing anything.
MANWIDTH=60 man ls
The same page then wraps near 60 columns, which keeps the option list readable in a split window or a side pane.
Keep a page as text
man --pager=cat ls > ls-manual.txt
The ls page writes out at 249 lines and 8,383 bytes, which I measured with wc after the redirect.
Man pages draw bold with backspaces rather than escape sequences, so a page captured through the pager carries control characters. The col filter removes them.
man ls | col -b > ls-manual.txt

Reading the export back is the check that matters, since a redirect that fails partway leaves a truncated file and a silent shell.
Keep a page as PDF
man -Tpdf looks like the flag for this job. I ran it expecting a PDF and got a groff error instead, before a single line was formatted.
man -Tpdf ls

The message points at the device rather than the page. That device ships in the groff package, while groff-base, the package a server image carries, leaves it out.
sudo apt install groff
Without that package the route that works is PostScript through ps2pdf, which arrives with Ghostscript.
man -t ls | ps2pdf - ls.pdf; file ls.pdf

When man gives you nothing
man exits with status 16 when a page, a file or a keyword did not match, and the message on the terminal says which of the three it was.
| What you see | What it means | What to run |
|---|---|---|
| zzzz: nothing appropriate. | the keyword index is missing, stale or unreadable | sudo mandb |
| No manual entry for cd | no page is installed under that name, and cd is a shell builtin | help cd |
| man: can’t resolve man7/groff_man.7 | a SEE ALSO cross reference points at a page that is not installed | man groff |
| man: command not found | man-db is missing, which is normal in container images | sudo apt install man-db |
| cannot load ‘DESC’ description file for device ‘pdf’ | groff-base is present without the pdf device | sudo apt install groff |
| No manual entry for a command that exists | the page sits in a hierarchy that MANPATH does not list | manpath |
The codes either side of 16 carry their own meaning. A clean read returns 0, a usage or configuration problem returns 1, an operational failure returns 2, and status 3 means a child process in the pipeline failed, which is the code the missing pdf device produces.
The builtin case is the one worth naming, because no package can supply a page for it. cd, alias and history live inside the shell, and help prints their documentation while man cannot.
The keyword index is the other case worth recognising, because man -k and apropos read a cache built by mandb. A container image or a freshly installed package tree can leave that cache empty until someone rebuilds it.
I reproduced that miss with a nonsense word, and the reply is nothing appropriate plus exit status 16.
sudo mandb
The rebuilt cache answers the next keyword search, and the rebuild itself runs through sudo because the cache directory belongs to the man user.
The page for man documents the parts you just used
The page you have been reading belongs to the tool itself. man(1) carries MANSECT for the section order, MANWIDTH for the wrap, and an EXIT STATUS section that gives 16 as the code for a page, file or keyword that did not match.
The search is what I kept, because a task word stands in for a name. The description it matches is the sentence you would have written yourself.
man -k password
That returns chage(1), chpasswd(8) and the rest of the password tools, which is a shorter list than a web search and one keystroke away from the page I want, which is the habit the Linux commands cheat sheet extends to the rest of the commands you reach for.
Frequently asked questions
How do you exit a man page?
Press q. The pager waits for that key, and it also answers h with its own key list.
How do you search inside a man page?
Type / then the word you want and press Enter. n jumps to the next match and N to the previous one.
How do you read a man page from a specific section?
Put the section number before the name, as in man 3 printf. man -f printf lists the sections that exist for that name.
What does nothing appropriate mean?
The keyword index that man -k and apropos read is missing or stale. Run sudo mandb and repeat the search.
How do you install man when the command is not found?
Run sudo apt install man-db. Container images and small server builds ship without it.
How do you save a man page to a file?
man –pager=cat ls > ls.txt writes plain text, and man -t ls | ps2pdf – ls.pdf writes a PDF.
