NAME
man — legacy formatting language for manual pagesDESCRIPTION
Traditionally, the man language has been used to write UNIX manuals for the man(1) utility. It supports limited control of presentational details like fonts, indentation and spacing. This reference document describes the structure of manual pages and the syntax and usage of the man language.
Do not use man to write your manuals:
It lacks support for semantic markup. Use the mdoc(7) language, instead..SH Macro lines change control state. Text lines are interpreted within the current state.
MANUAL STRUCTURE
Each man document must contain the TH macro describing the document's section and title. It may occur anywhere in the document, although conventionally it appears as the first macro..TH PROGNAME 1 2009-10-10 .SH NAME \fBprogname\fR \(en one line about what it does .\" .SH LIBRARY .\" For sections 2, 3, and 9 only. .\" Not used in OpenBSD. .SH SYNOPSIS \fBprogname\fR [\fB\-options\fR] \fIfile ...\fR .SH DESCRIPTION The \fBfoo\fR utility processes files ... .\" .Sh CONTEXT .\" For section 9 functions only. .\" .SH IMPLEMENTATION NOTES .\" Not used in OpenBSD. .\" .SH RETURN VALUES .\" For sections 2, 3, and 9 function return values only. .\" .SH ENVIRONMENT .\" For sections 1, 6, 7, and 8 only. .\" .SH FILES .\" .SH EXIT STATUS .\" For sections 1, 6, and 8 only. .\" .SH EXAMPLES .\" .SH DIAGNOSTICS .\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. .\" .SH ERRORS .\" For sections 2, 3, 4, and 9 errno settings only. .\" .SH SEE ALSO .\" .BR foobar ( 1 ) .\" .SH STANDARDS .\" .SH HISTORY .\" .SH AUTHORS .\" .SH CAVEATS .\" .SH BUGS .\" .SH SECURITY CONSIDERATIONS .\" Not used in OpenBSD.
- NAME
-
The name(s) and a short description of the documented material. The syntax for this is generally as follows:\fBname\fR \(en description
- LIBRARY
-
The name of the library containing the documented material, which is assumed to be a function in a section 2 or 3 manual. For functions in the C library, this may be as follows:Standard C Library (libc, -lc)
- SYNOPSIS
-
Documents the utility invocation syntax, function call syntax, or device configuration.\fBname\fR [-\fBab\fR] [-\fBc\fR\fIarg\fR] \fBpath\fR....B char *name(char *\fIarg\fR);.B name* at cardbus? function?
- DESCRIPTION
- This expands upon the brief, one-line description in NAME. It usually contains a break-down of the options (if documenting a command).
- CONTEXT
- This section lists the contexts in which functions can be called in section 9. The contexts are autoconf, process, or interrupt.
- IMPLEMENTATION NOTES
- Implementation-specific notes should be kept here. This is useful when implementing standard functions that may have side effects or notable algorithmic implications.
- RETURN VALUES
- This section documents the return values of functions in sections 2, 3, and 9.
- ENVIRONMENT
- Documents any usages of environment variables, e.g., environ(7).
- FILES
- Documents files used. It's helpful to document both the file name and a short description of how the file is used (created, modified, etc.).
- EXIT STATUS
- This section documents the command exit status for section 1, 6, and 8 utilities. Historically, this information was described in DIAGNOSTICS, a practise that is now discouraged.
- EXAMPLES
- Example usages. This often contains snippets of well-formed, well-tested invocations. Make sure that examples work properly!
- DIAGNOSTICS
-
Documents error conditions. In section 4 and 9 manuals, these are usually messages printed by the kernel to the console and to the kernel log. In section 1, 6, 7, and 8, these are usually messages printed by userland programs to the standard error output.
- ERRORS
- Documents errno(2) settings in sections 2, 3, 4, and 9.
- SEE ALSO
-
References other manuals with related topics. This section should exist for most manuals..BR bar ( 1 ),
- STANDARDS
-
References any standards implemented or used, such asIEEE Std 1003.2 (\(lqPOSIX.2\(rq)
- HISTORY
- A brief history of the subject, including where support first appeared.
- AUTHORS
- Credits to the person or persons who wrote the code and/or documentation. Authors should generally be noted by both name and email address.
- CAVEATS
- Common misuses and misunderstandings should be explained in this section.
- BUGS
- Known bugs, limitations, and work-arounds should be described in this section.
- SECURITY CONSIDERATIONS
- Documents any security precautions that operators should consider.
MACRO OVERVIEW
This overview is sorted such that macros of similar purpose are listed together, to help find the best macro for any given purpose. Deprecated macros are not included in the overview, but can be found in the alphabetical reference below.Page header and footer meta-data
TH | set the title: title section date [source [volume]] |
AT | display AT&T UNIX version in the page footer (<= 1 argument) |
UC | display BSD version in the page footer (<= 1 argument) |
Sections and paragraphs
SH | section header (one line) |
SS | subsection header (one line) |
PP, LP, P | start an undecorated paragraph (no arguments) |
RS, RE | reset the left margin: [width] |
IP | indented paragraph: [head [width]] |
TP | tagged paragraph: [width] |
HP | hanged paragraph: [width] |
PD | set vertical paragraph distance: [height] |
br | force output line break in text mode (no arguments) |
sp | force vertical space: [height] |
fi, nf | fill mode and no-fill mode (no arguments) |
in | additional indent: [width] |
Physical markup
B | boldface font |
I | italic font |
R | roman (default) font |
SB | small boldface font |
SM | small roman font |
BI | alternate between boldface and italic fonts |
BR | alternate between boldface and roman fonts |
IB | alternate between italic and boldface fonts |
IR | alternate between italic and roman fonts |
RB | alternate between roman and boldface fonts |
RI | alternate between roman and italic fonts |
MACRO REFERENCE
This section is a canonical reference to all macros, arranged alphabetically. For the scoping of individual macros, see MACRO SYNTAX.AT
Sets the volume for the footer for compatibility with man pages from AT&T UNIX releases. The optional arguments specify which release it is from.BI
Text is rendered alternately in bold face and italic. Thus, ‘.BI this word and that’ causes ‘this’ and ‘and’ to render in bold face, while ‘word’ and ‘that’ render in italics. Whitespace between arguments is omitted in output..BI bold italic bold italic
BR
Text is rendered alternately in bold face and roman (the default font). Whitespace between arguments is omitted in output.DT
Has no effect. Included for compatibility.EE
This is a non-standard GNU extension, included only for compatibility. In mandoc(1), it does the same as fi.EX
This is a non-standard GNU extension, included only for compatibility. In mandoc(1), it does the same as nf.HP
Begin a paragraph whose initial output line is left-justified, but subsequent output lines are indented, with the following syntax:
.HP [width]
IB
Text is rendered alternately in italics and bold face. Whitespace between arguments is omitted in output.IP
Begin an indented paragraph with the following syntax:
.IP [head [width]]
IR
Text is rendered alternately in italics and roman (the default font). Whitespace between arguments is omitted in output.LP
Begin an undecorated paragraph. The scope of a paragraph is closed by a subsequent paragraph, sub-section, section, or end of file. The saved paragraph left-margin width is reset to the default.OP
Optional command-line argument. This is a non-standard GNU extension, included only for compatibility. It has the following syntax:
.OP key [value]
PD
Specify the vertical space to be inserted before each new paragraph.
.PD [height]
RB
Text is rendered alternately in roman (the default font) and bold face. Whitespace between arguments is omitted in output.RE
Explicitly close out the scope of a prior RS. The default left margin is restored to the state before that RS invocation.
.RE [level]
− 1
nested RS blocks remain open.RI
Text is rendered alternately in roman (the default font) and italics. Whitespace between arguments is omitted in output.RS
Temporarily reset the default left margin. This has the following syntax:
.RS [width]
SB
Text is rendered in small size (one point smaller than the default font) bold face.SH
Begin a section. The scope of a section is only closed by another section or the end of file. The paragraph left-margin width is reset to the default.SM
Text is rendered in small size (one point smaller than the default font).SS
Begin a sub-section. The scope of a sub-section is closed by a subsequent sub-section, section, or end of file. The paragraph left-margin width is reset to the default.TH
Sets the title of the manual page for use in the page header and footer with the following syntax:
.TH title section date [source [volume]]
.TH CVS 5 1992-02-12 GNU
TP
Begin a paragraph where the head, if exceeding the indentation width, is followed by a newline; if not, the body follows on the same line after a buffer to the indentation width. Subsequent output lines are indented. The syntax is as follows:
.TP [width]
UC
Sets the volume for the footer for compatibility with man pages from BSD releases. The optional first argument specifies which release it is from.UE
End a uniform resource identifier block. This is a non-standard GNU extension, included only for compatibility. See UE.UR
Begin a uniform resource identifier block. This is a non-standard GNU extension, included only for compatibility. It has the following syntax:.UR uri link description to be shown .UE
in
Indent relative to the current indentation:.in [width]
MACRO SYNTAX
The man macros are classified by scope: line scope or block scope. Line macros are only scoped to the current line (and, in some situations, the subsequent line). Block macros are scoped to the current line and subsequent lines until closed by another block macro.Line Macros
Line macros are generally scoped to the current line, with the body consisting of zero or more arguments. If a macro is scoped to the next line and the line arguments are empty, the next line, which must be text, is used instead. Thus:.I foo
.YO [body...] [body...]
Macro | Arguments | Scope | Notes |
AT | <=1 | current | |
B | n | next-line | |
BI | n | current | |
BR | n | current | |
DT | 0 | current | |
EE | 0 | current | compat |
EX | 0 | current | compat |
I | n | next-line | |
IB | n | current | |
IR | n | current | |
OP | 0, 1 | current | compat |
PD | 1 | current | |
R | n | next-line | |
RB | n | current | |
RI | n | current | |
SB | n | next-line | |
SM | n | next-line | |
TH | >1, <6 | current | |
UC | <=1 | current | |
br | 0 | current | compat |
fi | 0 | current | compat |
in | 1 | current | compat |
nf | 0 | current | compat |
sp | 1 | current | compat |
Block Macros
Block macros comprise a head and body. As with in-line macros, the head is scoped to the current line and, in one circumstance, the next line (the next-line stipulations as in Line Macros apply here as well)..YO [head...] [head...] [body...]
Macro | Arguments | Head Scope | Body Scope | Notes |
HP | <2 | current | paragraph | |
IP | <3 | current | paragraph | |
LP | 0 | current | paragraph | |
P | 0 | current | paragraph | |
PP | 0 | current | paragraph | |
RE | 0 | current | none | compat |
RS | 1 | current | part | compat |
SH | >0 | next-line | section | |
SS | >0 | next-line | sub-section | |
TP | n | next-line | paragraph | |
UE | 0 | current | none | compat |
UR | 1 | current | part | compat |
Font handling
In man documents, both Physical markup macros and roff(7) ‘\f
’ font escape sequences can be used to choose fonts. In text lines, the effect of manual font selection by escape sequences only lasts until the next macro invocation; in macro lines, it only lasts until the end of the macro scope. Note that macros like BR open and close a font scope for each argument.