Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a specification for a man page's SYNOPSIS section?

Tags:

syntax

manpage

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.

Unix manual page on the "man" command

like image 424
wersimmon Avatar asked Jan 03 '12 17:01

wersimmon


People also ask

What is man page synopsis?

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.

What do square brackets [] mean in the synopsis section of a man page?

The square brackets ( [ ] ) indicate that the enclosed element (parameter, value, or information) is optional.

What does bold text mean in the synopsis section of a man page?

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.


2 Answers

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

like image 173
Fred Foo Avatar answered Sep 21 '22 18:09

Fred Foo


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

like image 33
Mats Kindahl Avatar answered Sep 18 '22 18:09

Mats Kindahl