Modular Computers the manual GitHub

man

man: show a manual page.

Synopsis

man [section] name

Description

man finds the manual page for name, formats it for the terminal and shows it through a pager. Pages are man(7) source, as on Linux, kept as /usr/share/man/mansection/name.section. With no section, sections 1, 8, 5 and 7 are searched, in that order.

On a terminal, the page is laid out to the terminal’s width, with bold and italic text (italics show underlined), and piped to $MANPAGER or $PAGER, else less(1). Into a pipe or a file, the plain text is written, 80 columns wide.

Environment

MANPATH
The manual trees to search, separated by :; /usr/share/man by default.
MANPAGER PAGER
The pager, run with sh -c; the first set is used.
LESS
Left as it is; when it isn’t set, man runs its pager with LESS=-R (as man-db does), so less(1) shows bold and underline instead of their escape sequences.

Page format

The formatter understands this part of man(7), and ignores other requests:

.TH title section
The page’s title, shown in its header and footer.
.SH .SS
A section heading, a subsection heading.
.PP .P .LP
A new paragraph (so does a blank line).
.TP
A tagged paragraph: the next line is the tag, the lines after it the indented body.
.IP tag
A tagged paragraph with the tag given.
.RS .RE
Indent further, and back.
.B .I
The line in bold, in italics.
.BR .RB .BI .IB .IR .RI
Words in fonts taking turns, with no spaces between them (quote a word to keep spaces in it).
.nf .fi
Lines as they are (no filling), and filled again.
.br .sp
A line break, a blank line.
.\”
A comment.

In text: \fB \fI \fR \fP change the font (bold, italic, roman, the previous one); \- is a minus, \e and \\ a backslash, \(em a dash, and nothing.

Exit status

0 on success; 1 with no name given; 16 if no page was found.

Examples

man ls
man 1 sh
man less > less.txt

Notes

There are no options and no -k; tables, other macros and other escapes are not supported.

See also

less(1)