]> git.ipfire.org Git - thirdparty/util-linux.git/blame - Documentation/howto-man-page.txt
dmesg: add --follow-new
[thirdparty/util-linux.git] / Documentation / howto-man-page.txt
CommitLineData
cfbebb29 1.\" This is a util-linux manual page example in troff format.
05620dd4 2.\"
cfbebb29 3.\" The .TH macro expects the following arguments:
05620dd4 4.\" title section date footer header
cfbebb29
BS
5.\" The title is usually the command name.
6.\" The section must match the filename extension.
7.\" The date is the month and year when the last update happened.
05620dd4 8.\" The footer is fixed to "util-linux".
cfbebb29 9.\" The header is a textual description of the section:
05620dd4
SK
10.\" 1 "User Commands"
11.\" 2 "System calls"
12.\" 3 "Programmer's Manual"
13.\" 4 "Special Files"
14.\" 5 "File Formats"
15.\" 6 "Games"
16.\" 7 "Miscellanea"
17.\" 8 "System Administration"
18.\"
cfbebb29 19.\" Please read `man 7 groff_man' to see how to use the various macros.
05620dd4 20.\"
326c5c93 21.TH EXAMPLE "1" "April 2016" "util-linux" "User Commands"
05620dd4 22.SH NAME
cfbebb29 23example \- a util-linux man-page howto
05620dd4
SK
24.SH SYNOPSIS
25.B example
26[options]
27.I argument
28.SH DESCRIPTION
cfbebb29
BS
29Each manual page needs some sort of description of the command.
30Write such here.
05620dd4
SK
31.SH OPTIONS
32.TP
37f26093
BIG
33.BR \-n ,\ \-\-no\-argument
34.\" \fB\-n\fR, \fB\-\-no\-argument\fR
cfbebb29 35This option does not use an argument.
05620dd4 36.TP
37f26093
BIG
37.BR \-\-optional [ =\c
38.IR argument ]
39.\" \fB\-\-optional\fR[\fI=argument\fR]
cfbebb29 40Tell in this description that the
05620dd4 41.I argument
cfbebb29 42is optional, and what happens when it is or is not given. Notice that the word
05620dd4 43.I argument
cfbebb29
BS
44is not abbreviated as is customary in the usage text. For example, when the
45usage text uses the argument
05620dd4
SK
46.IR num ,
47the manual page should say
48.IR number .
326c5c93
SK
49.IP
50Notice that after release v2.28 it was decided that introducing new options
51taking optional arguments should be limited to long-only options. This is
52done primarily to avoid problematic behaviour of short options. Imagine for
53example normal option
54.B \-n
55and optional option
56.BR \-o .
57One will expect
58.B command \ \-no
59and
60.B command \ \-on
61to be the same, but in fact the former is two separate options while the
62later will use
63.B n
64as option argument of
37f26093 65.BR \-o .
326c5c93 66So it is best to avoid short forms of optional options altogether.
05620dd4 67.TP
37f26093
BIG
68.BR \-r ,\ \-\-required\ \c
69.I argument
70.\"\fB\-r\fR, \fB\-\-required\fR \fIargument\fR
cfbebb29 71Tell in this description that the
05620dd4
SK
72.I argument
73is required.
74.TP
37f26093
BIG
75.BR \-V ", " \-\-version
76.\"\fB\-V\fR, \fB\-\-version\fR
05620dd4
SK
77Display version information and exit.
78.TP
37f26093
BIG
79.BR \-h ,\ \-\-help
80.\"\fB\-h\fR, \fB\-\-help\fR
cfbebb29 81Display help text and exit.
05620dd4 82.SH NOTES
cfbebb29 83Tell details that users might need to know. For example, kernel feature or
05620dd4
SK
84version requirements.
85.PP
cfbebb29 86The man-page source lines should not exceed 80 characters in length.
05620dd4 87.PP
cfbebb29
BS
88Do not leave empty lines in the groff input. If you need a break or a new
89paragraph, use the appropriate groff macros. See
05620dd4
SK
90.BR groff_man (7)
91how to use man page macros.
92.PP
cfbebb29 93The use cases of
05620dd4 94.I italic
cfbebb29 95(which is underlined on a terminal) and
05620dd4 96.B bold
cfbebb29
BS
97are not strictly defined. The main convention is that
98.I symbolic arguments
99use italic, and
100.B commands
101and
102.B literal arguments
103use bold, and
104.I other highlights
105use
106.B either
107one.
05620dd4
SK
108.\"
109.\" The manual page comments are undervalued way of adding clarifications
110.\" quite not belong to the manual, questions, TODO items etc. Feel free
111.\" to use them.
112.\"
113.PP
114When in the source a new sentence begins somewhere midline, it should use a
37f26093
BIG
115double space before its initial letter. This is done because
116.B groff
cfbebb29
BS
117uses a double space after a sentence when this sentence ends at the end of
118an input line and the next sentence begins on the next line.
119Unless a double space is used before other sentence starts as well, the
120spacing style will be inconsistent.
05620dd4 121.SH ENVIRONMENT
cfbebb29 122Tell which environment variables affect, and how, the execution of the command.
05620dd4
SK
123.TP
124.B EXAMPLE_PATH
cfbebb29
BS
125Configuration file path. Notice that well-known environment variables, such as
126.BR HOME ,
127do not need explanation.
05620dd4 128.SH FILES
cfbebb29 129Tell which file(s) the command uses.
05620dd4
SK
130.TP
131.B $EXAMPLE_PATH
132.TQ
133.B $HOME/.example.conf
134.TQ
135.B /etc/example.conf
cfbebb29
BS
136What are these files, in which order are they read, and will the evaluation
137end or continue if one of them is found.
138In case the explanation is not simple, write a separate "Special Files"
139manual page that tells about syntax, meaning of key-value settings, etc.
140This "Special Files" manual page then needs to be referred in the
05620dd4
SK
141.B SEE ALSO
142section.
143.TP
144.B /var/log/example.log
145Another file.
146.SH EXAMPLES
cfbebb29
BS
147Write typical and/or clever use examples here. The below examples are stupid,
148and you should never write them in a real man page.
05620dd4 149.TP
37f26093 150.B example \-h
05620dd4
SK
151Output help screen.
152.TP
37f26093 153.B example \-V
05620dd4
SK
154Output version information.
155.SH "EXIT STATUS"
cfbebb29 156This section can be left out if the command has only two return values,
05620dd4
SK
157.B 0
158for success and
159.B 1
160for failure. Use of
161.B sysexits.h
162return values must be mentioned, but does not need to be explained.
163.PP
164.RS
165.PD 0
166.TP
167.B 0
168success
169.TP
170.B 1
171failure
172.TP
173.B 2
174tell why this could happen
175.TP
176.B 3
177etc
178.PD
179.RE
180.SH AUTHORS
8a69abf0 181.MT rjh@\:example.org
37f26093 182Random J.\& Hacker
8a69abf0 183.ME
05620dd4 184.br
8a69abf0 185.MT fred@\:example.com
05620dd4 186Fred Foobar
8a69abf0 187.ME
05620dd4
SK
188.SH "SEE ALSO"
189.BR groff_man (7),
190.BR foo (1),
191.BR bar (8)
192.SH AVAILABILITY
193The example command is part of the util-linux package and is available from
d673b74e 194.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
05620dd4
SK
195Linux Kernel Archive
196.UE .