]>
Commit | Line | Data |
---|---|---|
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 | 23 | example \- a util-linux man-page howto |
05620dd4 SK |
24 | .SH SYNOPSIS |
25 | .B example | |
26 | [options] | |
27 | .I argument | |
28 | .SH DESCRIPTION | |
cfbebb29 BS |
29 | Each manual page needs some sort of description of the command. |
30 | Write 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 | 35 | This 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 | 40 | Tell in this description that the |
05620dd4 | 41 | .I argument |
cfbebb29 | 42 | is optional, and what happens when it is or is not given. Notice that the word |
05620dd4 | 43 | .I argument |
cfbebb29 BS |
44 | is not abbreviated as is customary in the usage text. For example, when the |
45 | usage text uses the argument | |
05620dd4 SK |
46 | .IR num , |
47 | the manual page should say | |
48 | .IR number . | |
326c5c93 SK |
49 | .IP |
50 | Notice that after release v2.28 it was decided that introducing new options | |
51 | taking optional arguments should be limited to long-only options. This is | |
52 | done primarily to avoid problematic behaviour of short options. Imagine for | |
53 | example normal option | |
54 | .B \-n | |
55 | and optional option | |
56 | .BR \-o . | |
57 | One will expect | |
58 | .B command \ \-no | |
59 | and | |
60 | .B command \ \-on | |
61 | to be the same, but in fact the former is two separate options while the | |
62 | later will use | |
63 | .B n | |
64 | as option argument of | |
37f26093 | 65 | .BR \-o . |
326c5c93 | 66 | So 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 | 71 | Tell in this description that the |
05620dd4 SK |
72 | .I argument |
73 | is required. | |
74 | .TP | |
37f26093 BIG |
75 | .BR \-V ", " \-\-version |
76 | .\"\fB\-V\fR, \fB\-\-version\fR | |
05620dd4 SK |
77 | Display version information and exit. |
78 | .TP | |
37f26093 BIG |
79 | .BR \-h ,\ \-\-help |
80 | .\"\fB\-h\fR, \fB\-\-help\fR | |
cfbebb29 | 81 | Display help text and exit. |
05620dd4 | 82 | .SH NOTES |
cfbebb29 | 83 | Tell details that users might need to know. For example, kernel feature or |
05620dd4 SK |
84 | version requirements. |
85 | .PP | |
cfbebb29 | 86 | The man-page source lines should not exceed 80 characters in length. |
05620dd4 | 87 | .PP |
cfbebb29 BS |
88 | Do not leave empty lines in the groff input. If you need a break or a new |
89 | paragraph, use the appropriate groff macros. See | |
05620dd4 SK |
90 | .BR groff_man (7) |
91 | how to use man page macros. | |
92 | .PP | |
cfbebb29 | 93 | The use cases of |
05620dd4 | 94 | .I italic |
cfbebb29 | 95 | (which is underlined on a terminal) and |
05620dd4 | 96 | .B bold |
cfbebb29 BS |
97 | are not strictly defined. The main convention is that |
98 | .I symbolic arguments | |
99 | use italic, and | |
100 | .B commands | |
101 | and | |
102 | .B literal arguments | |
103 | use bold, and | |
104 | .I other highlights | |
105 | use | |
106 | .B either | |
107 | one. | |
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 | |
114 | When in the source a new sentence begins somewhere midline, it should use a | |
37f26093 BIG |
115 | double space before its initial letter. This is done because |
116 | .B groff | |
cfbebb29 BS |
117 | uses a double space after a sentence when this sentence ends at the end of |
118 | an input line and the next sentence begins on the next line. | |
119 | Unless a double space is used before other sentence starts as well, the | |
120 | spacing style will be inconsistent. | |
05620dd4 | 121 | .SH ENVIRONMENT |
cfbebb29 | 122 | Tell which environment variables affect, and how, the execution of the command. |
05620dd4 SK |
123 | .TP |
124 | .B EXAMPLE_PATH | |
cfbebb29 BS |
125 | Configuration file path. Notice that well-known environment variables, such as |
126 | .BR HOME , | |
127 | do not need explanation. | |
05620dd4 | 128 | .SH FILES |
cfbebb29 | 129 | Tell 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 |
136 | What are these files, in which order are they read, and will the evaluation |
137 | end or continue if one of them is found. | |
138 | In case the explanation is not simple, write a separate "Special Files" | |
139 | manual page that tells about syntax, meaning of key-value settings, etc. | |
140 | This "Special Files" manual page then needs to be referred in the | |
05620dd4 SK |
141 | .B SEE ALSO |
142 | section. | |
143 | .TP | |
144 | .B /var/log/example.log | |
145 | Another file. | |
146 | .SH EXAMPLES | |
cfbebb29 BS |
147 | Write typical and/or clever use examples here. The below examples are stupid, |
148 | and you should never write them in a real man page. | |
05620dd4 | 149 | .TP |
37f26093 | 150 | .B example \-h |
05620dd4 SK |
151 | Output help screen. |
152 | .TP | |
37f26093 | 153 | .B example \-V |
05620dd4 SK |
154 | Output version information. |
155 | .SH "EXIT STATUS" | |
cfbebb29 | 156 | This section can be left out if the command has only two return values, |
05620dd4 SK |
157 | .B 0 |
158 | for success and | |
159 | .B 1 | |
160 | for failure. Use of | |
161 | .B sysexits.h | |
162 | return values must be mentioned, but does not need to be explained. | |
163 | .PP | |
164 | .RS | |
165 | .PD 0 | |
166 | .TP | |
167 | .B 0 | |
168 | success | |
169 | .TP | |
170 | .B 1 | |
171 | failure | |
172 | .TP | |
173 | .B 2 | |
174 | tell why this could happen | |
175 | .TP | |
176 | .B 3 | |
177 | etc | |
178 | .PD | |
179 | .RE | |
180 | .SH AUTHORS | |
8a69abf0 | 181 | .MT rjh@\:example.org |
37f26093 | 182 | Random J.\& Hacker |
8a69abf0 | 183 | .ME |
05620dd4 | 184 | .br |
8a69abf0 | 185 | .MT fred@\:example.com |
05620dd4 | 186 | Fred 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 | |
193 | The 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 |
195 | Linux Kernel Archive |
196 | .UE . |