I'm trying to write some specifications to be shared between a small team and getting picky about the format I put some command listings in. Is there any formal definition of the syntax used in the SYNOPSIS section of man pages?
From the Wikimedia Commons, here's an example of a man page with the SYNOPSIS section I'm talking about, where the command is listed with the required and optional arguments it understands.
SYNOPSIS A brief summary of the command or function's interface. For commands, this shows the syntax of the command and its arguments (including options); boldface is used for as-is text and italics are used to indicate replaceable arguments.
The square brackets ( [ ] ) indicate that the enclosed element (parameter, value, or information) is optional.
bold text type exactly as shown. italic text replace with appropriate argument. [-abc] any or all arguments within [ ] are optional. - a|-b options delimited by | cannot be used together.
There is no formal definition of a manpage anywhere, not even in the POSIX standard. The man(1)
manpage in your example is pretty typical: you write out the various ways a program can be used (often just one) with []
denoting optional, bold (or typewriter font with the mdoc
macros) denoting literal command line input and italics denoting variables.
The manpages man(7)
and mdoc(7)
will explain the most important conventions. man(7)
is for old-style Unix manpages and is still popular on Linux (see man-pages(7)
); mdoc(7)
comes from 4.4BSD and is popular in its derivatives. The latter maintains a stricter separation of content and presentation and can produce (IMHO) prettier PDF/HTML output
The utility conventions for utilities are documented in in Chapter 12. Utility conventions of the IEEE Std 1003.1, 2004 Edition.
A newer edition of this document exists here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With