sigaction.2: Minor clean-ups to Peter Collingbourne's patch
[man-pages.git] / man7 / man.7
blobedabde45ce7585b7b426a9a67258c786644b1843
1 .\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
2 .\" (faith@cs.unc.edu and dwheeler@ida.org)
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Modified Sun Jul 25 11:06:05 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified Sat Jun  8 00:39:52 1996 by aeb
28 .\" Modified Wed Jun 16 23:00:00 1999 by David A. Wheeler (dwheeler@ida.org)
29 .\" Modified Thu Jul 15 12:43:28 1999 by aeb
30 .\" Modified Sun Jan  6 18:26:25 2002 by Martin Schulze <joey@infodrom.org>
31 .\" Modified Tue Jul 27 20:12:02 2004 by Colin Watson <cjwatson@debian.org>
32 .\" 2007-05-30, mtk: various rewrites and moved much text to new man-pages.7.
33 .\"
34 .TH MAN 7 2021-03-22 "Linux" "Linux Programmer's Manual"
35 .SH NAME
36 man \- macros to format man pages
37 .SH SYNOPSIS
38 .B groff \-Tascii \-man
39 .I file
40 \&...
41 .br
42 .B groff \-Tps \-man
43 .I file
44 \&...
45 .PP
46 .B man
47 .RI [ section ]
48 .I title
49 .SH DESCRIPTION
50 This manual page explains the
51 .B "groff an.tmac"
52 macro package (often called the
53 .B man
54 macro package).
55 This macro package should be used by developers when
56 writing or porting man pages for Linux.
57 It is fairly compatible with other
58 versions of this macro package, so porting man pages should not be a major
59 problem (exceptions include the NET-2 BSD release, which uses a totally
60 different macro package called mdoc; see
61 .BR mdoc (7)).
62 .PP
63 Note that NET-2 BSD mdoc man pages can be used with
64 .B groff
65 simply by specifying the
66 .B \-mdoc
67 option instead of the
68 .B \-man
69 option.
70 Using the
71 .B \-mandoc
72 option is, however, recommended, since this will automatically detect which
73 macro package is in use.
74 .PP
75 For conventions that should be employed when writing man pages
76 for the Linux \fIman-pages\fP package, see
77 .BR man\-pages (7).
78 .SS Title line
79 The first command in a man page (after comment lines,
80 that is, lines that start with \fB.\e"\fP) should be
81 .PP
82 .RS
83 .B \&.TH
84 .I "title section date source manual"
85 .RE
86 .PP
87 For details of the arguments that should be supplied to the
88 .B TH
89 command, see
90 .BR man\-pages (7).
91 .PP
92 Note that BSD mdoc-formatted pages begin with the
93 .B Dd
94 command, not the
95 .B TH
96 command.
97 .SS Sections
98 Sections are started with
99 .B \&.SH
100 followed by the heading name.
101 .\" The following doesn't seem to be required (see Debian bug 411303),
102 .\" If the name contains spaces and appears
103 .\" on the same line as
104 .\" .BR \&.SH ,
105 .\" then place the heading in double quotes.
107 The only mandatory heading is NAME, which should be the first section and
108 be followed on the next line by a one-line description of the program:
111 \&.SH NAME
113 item \e- description
116 It is extremely important that this format is followed, and that there is a
117 backslash before the single dash which follows the item name.
118 This syntax is used by the
119 .BR mandb (8)
120 program to create a database of short descriptions for the
121 .BR whatis (1)
123 .BR apropos (1)
124 commands.
125 (See
126 .BR lexgrog (1)
127 for further details on the syntax of the NAME section.)
129 For a list of other sections that might appear in a manual page, see
130 .BR man\-pages (7).
131 .SS Fonts
132 The commands to select the type face are:
133 .TP 4
134 .B \&.B
135 Bold
137 .B \&.BI
138 Bold alternating with italics
139 (especially useful for function specifications)
141 .B \&.BR
142 Bold alternating with Roman
143 (especially useful for referring to other
144 manual pages)
146 .B \&.I
147 Italics
149 .B \&.IB
150 Italics alternating with bold
152 .B \&.IR
153 Italics alternating with Roman
155 .B \&.RB
156 Roman alternating with bold
158 .B \&.RI
159 Roman alternating with italics
161 .B \&.SB
162 Small alternating with bold
164 .B \&.SM
165 Small (useful for acronyms)
167 Traditionally, each command can have up to six arguments, but the GNU
168 implementation removes this limitation (you might still want to limit
169 yourself to 6 arguments for portability's sake).
170 Arguments are delimited by spaces.
171 Double quotes can be used to specify an argument which contains spaces.
172 For the macros that produce alternating type faces,
173 the arguments will be printed next to each other without
174 intervening spaces, so that the
175 .B \&.BR
176 command can be used to specify a word in bold followed by a mark of
177 punctuation in Roman.
178 If no arguments are given, the command is applied to the following line
179 of text.
180 .SS Other macros and strings
181 Below are other relevant macros and predefined strings.
182 Unless noted otherwise, all macros
183 cause a break (end the current line of text).
184 Many of these macros set or use the "prevailing indent".
185 The "prevailing indent" value is set by any macro with the parameter
186 .I i
187 below;
188 macros may omit
189 .I i
190 in which case the current prevailing indent will be used.
191 As a result, successive indented paragraphs can use the same indent without
192 respecifying the indent value.
193 A normal (nonindented) paragraph resets the prevailing indent value
194 to its default value (0.5 inches).
195 By default, a given indent is measured in ens;
196 try to use ens or ems as units for
197 indents, since these will automatically adjust to font size changes.
198 The other key macro definitions are:
199 .SS Normal paragraphs
200 .TP 9m
201 .B \&.LP
202 Same as
203 .B \&.PP
204 (begin a new paragraph).
206 .B \&.P
207 Same as
208 .B \&.PP
209 (begin a new paragraph).
211 .B \&.PP
212 Begin a new paragraph and reset prevailing indent.
213 .SS Relative margin indent
214 .TP 9m
215 .BI \&.RS " i"
216 Start relative margin indent: moves the left margin
217 .I i
218 to the right (if
219 .I i
220 is omitted, the prevailing indent value is used).
221 A new prevailing indent is set to 0.5 inches.
222 As a result, all following paragraph(s) will be
223 indented until the corresponding
224 .BR \&.RE .
226 .B \&.RE
227 End relative margin indent and
228 restores the previous value of the prevailing indent.
229 .SS Indented paragraph macros
230 .TP 9m
231 .BI \&.HP " i"
232 Begin paragraph with a hanging indent
233 (the first line of the paragraph is at the left margin of
234 normal paragraphs, and the rest of the paragraph's lines are indented).
236 .BI \&.IP " x i"
237 Indented paragraph with optional hanging tag.
238 If the tag
239 .I x
240 is omitted, the entire following paragraph is indented by
241 .IR i .
242 If the tag
243 .I x
244 is provided, it is hung at the left margin
245 before the following indented paragraph
246 (this is just like
247 .B \&.TP
248 except the tag is included with the command instead of being on the
249 following line).
250 If the tag is too long, the text after the tag will be moved down to the
251 next line (text will not be lost or garbled).
252 For bulleted lists, use this macro with \e(bu (bullet) or \e(em (em dash)
253 as the tag, and for numbered lists, use the number or letter followed by
254 a period as the tag;
255 this simplifies translation to other formats.
257 .BI \&.TP " i"
258 Begin paragraph with hanging tag.
259 The tag is given on the next line, but
260 its results are like those of the
261 .B \&.IP
262 command.
263 .SS Hypertext link macros
265 .BI \&.UR " url"
266 Insert a hypertext link to the URI (URL)
267 .IR url ,
268 with all text up to the following
269 .B \&.UE
270 macro as the link text.
272 .B \&.UE \c
273 .RI [ trailer ]
274 Terminate the link text of the preceding
275 .B \&.UR
276 macro, with the optional
277 .I trailer
278 (if present, usually a closing parenthesis and/or end-of-sentence
279 punctuation) immediately following.
280 For non-HTML output devices (e.g.,
281 .BR "man \-Tutf8" ),
282 the link text is followed by the URL in angle brackets; if there is no
283 link text, the URL is printed as its own link text, surrounded by angle
284 brackets.
285 (Angle brackets may not be available on all output devices.)
286 For the HTML output device, the link text is hyperlinked to the URL; if
287 there is no link text, the URL is printed as its own link text.
289 These macros have been supported since GNU Troff 1.20 (2009-01-05) and
290 Heirloom Doctools Troff since 160217 (2016-02-17).
291 .SS Miscellaneous macros
292 .TP 9m
293 .B \&.DT
294 Reset tabs to default tab values (every 0.5 inches);
295 does not cause a break.
297 .BI \&.PD " d"
298 Set inter-paragraph vertical distance to d
299 (if omitted, d=0.4v);
300 does not cause a break.
302 .BI \&.SS " t"
303 Subheading
304 .I t
305 (like
306 .BR \&.SH ,
307 but used for a subsection inside a section).
308 .SS Predefined strings
310 .B man
311 package has the following predefined strings:
312 .IP \e*R
313 Registration Symbol: \*R
314 .IP \e*S
315 Change to default font size
316 .IP \e*(Tm
317 Trademark Symbol: \*(Tm
318 .IP \e*(lq
319 Left angled double quote: \*(lq
320 .IP \e*(rq
321 Right angled double quote: \*(rq
322 .SS Safe subset
323 Although technically
324 .B man
325 is a troff macro package, in reality a large number of other tools
326 process man page files that don't implement all of troff's abilities.
327 Thus, it's best to avoid some of troff's more exotic abilities
328 where possible to permit these other tools to work correctly.
329 Avoid using the various troff preprocessors
330 (if you must, go ahead and use
331 .BR tbl (1),
332 but try to use the
333 .B IP
335 .B TP
336 commands instead for two-column tables).
337 Avoid using computations; most other tools can't process them.
338 Use simple commands that are easy to translate to other formats.
339 The following troff macros are believed to be safe (though in many cases
340 they will be ignored by translators):
341 .BR \e" ,
342 .BR . ,
343 .BR ad ,
344 .BR bp ,
345 .BR br ,
346 .BR ce ,
347 .BR de ,
348 .BR ds ,
349 .BR el ,
350 .BR ie ,
351 .BR if ,
352 .BR fi ,
353 .BR ft ,
354 .BR hy ,
355 .BR ig ,
356 .BR in ,
357 .BR na ,
358 .BR ne ,
359 .BR nf ,
360 .BR nh ,
361 .BR ps ,
362 .BR so ,
363 .BR sp ,
364 .BR ti ,
365 .BR tr .
367 You may also use many troff escape sequences (those sequences beginning
368 with \e).
369 When you need to include the backslash character as normal text,
370 use \ee.
371 Other sequences you may use, where x or xx are any characters and N
372 is any digit, include:
373 .BR \e\(aq ,
374 .BR \e\(ga ,
375 .BR \e- ,
376 .BR \e. ,
377 .BR \e" ,
378 .BR \e% ,
379 .BR \e*x ,
380 .BR \e*(xx ,
381 .BR \e(xx ,
382 .BR \e$N ,
383 .BR \enx ,
384 .BR \en(xx ,
385 .BR \efx ,
387 .BR \ef(xx .
388 Avoid using the escape sequences for drawing graphics.
390 Do not use the optional parameter for
391 .B bp
392 (break page).
393 Use only positive values for
394 .B sp
395 (vertical space).
396 Don't define a macro
397 .RB ( de )
398 with the same name as a macro in this or the
399 mdoc macro package with a different meaning; it's likely that
400 such redefinitions will be ignored.
401 Every positive indent
402 .RB ( in )
403 should be paired with a matching negative indent
404 (although you should be using the
405 .B RS
407 .B RE
408 macros instead).
409 The condition test
410 .RB ( if,ie )
411 should only have \(aqt\(aq or \(aqn\(aq as the condition.
412 Only translations
413 .RB ( tr )
414 that can be ignored should be used.
415 Font changes
416 .RB ( ft
417 and the \fB\ef\fP escape sequence)
418 should only have the values 1, 2, 3, 4, R, I, B, P, or CW
419 (the ft command may also have no parameters).
421 If you use capabilities beyond these, check the
422 results carefully on several tools.
423 Once you've confirmed that the additional capability is safe,
424 let the maintainer of this
425 document know about the safe command or sequence
426 that should be added to this list.
427 .SH FILES
428 .IR /usr/share/groff/ [*/] tmac/an.tmac
430 .I /usr/man/whatis
431 .SH NOTES
432 By all means include full URLs (or URIs) in the text itself;
433 some tools such as
434 .BR man2html (1)
435 can automatically turn them into hypertext links.
436 You can also use the
437 .B UR
439 .B UE
440 macros to identify links to related information.
441 If you include URLs, use the full URL
442 (e.g.,
443 .UR http://www.kernel.org
444 .UE )
445 to ensure that tools can automatically find the URLs.
447 Tools processing these files should open the file and examine the first
448 nonwhitespace character.
449 A period (.) or single quote (\(aq) at the beginning
450 of a line indicates a troff-based file (such as man or mdoc).
451 A left angle bracket (<) indicates an SGML/XML-based
452 file (such as HTML or Docbook).
453 Anything else suggests simple ASCII
454 text (e.g., a "catman" result).
456 Many man pages begin with \fB\(aq\e"\fP followed by a
457 space and a list of characters,
458 indicating how the page is to be preprocessed.
459 For portability's sake to non-troff translators we recommend
460 that you avoid using anything other than
461 .BR tbl (1),
462 and Linux can detect that automatically.
463 However, you might want to include this information so your man page
464 can be handled by other (less capable) systems.
465 Here are the definitions of the preprocessors invoked by these characters:
466 .TP 3
467 .B e
468 eqn(1)
470 .B g
471 grap(1)
473 .B p
474 pic(1)
476 .B r
477 refer(1)
479 .B t
480 tbl(1)
482 .B v
483 vgrind(1)
484 .SH BUGS
485 Most of the macros describe formatting (e.g., font type and spacing) instead
486 of marking semantic content (e.g., this text is a reference to another page),
487 compared to formats like mdoc and DocBook (even HTML has more semantic
488 markings).
489 This situation makes it harder to vary the
490 .B man
491 format for different media,
492 to make the formatting consistent for a given media, and to automatically
493 insert cross-references.
494 By sticking to the safe subset described above, it should be easier to
495 automate transitioning to a different reference page format in the future.
497 The Sun macro
498 .B TX
499 is not implemented.
500 .\" .SH AUTHORS
501 .\" .IP \(em 3m
502 .\" James Clark (jjc@jclark.com) wrote the implementation of the macro package.
503 .\" .IP \(em
504 .\" Rickard E. Faith (faith@cs.unc.edu) wrote the initial version of
505 .\" this manual page.
506 .\" .IP \(em
507 .\" Jens Schweikhardt (schweikh@noc.fdn.de) wrote the Linux Man-Page Mini-HOWTO
508 .\" (which influenced this manual page).
509 .\" .IP \(em
510 .\" David A. Wheeler (dwheeler@ida.org) heavily modified this
511 .\" manual page, such as adding detailed information on sections and macros.
512 .SH SEE ALSO
513 .BR apropos (1),
514 .BR groff (1),
515 .BR lexgrog (1),
516 .BR man (1),
517 .BR man2html (1),
518 .BR whatis (1),
519 .BR groff_man (7),
520 .BR groff_www (7),
521 .BR man\-pages (7),
522 .BR mdoc (7)