]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/man-pages.7
libc.7: Add a note on why glibc 2.x uses the soname libc.so.6
[thirdparty/man-pages.git] / man7 / man-pages.7
CommitLineData
ba83bc0d
MK
1.\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
2.\" (faith@cs.unc.edu and dwheeler@ida.org)
c11b1abf 3.\" and (C) Copyright 2007 Michael Kerrisk <mtk.manpages@gmail.com>
ba83bc0d 4.\"
93015253 5.\" %%%LICENSE_START(VERBATIM)
ba83bc0d
MK
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
14.\"
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
22.\"
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 25.\" %%%LICENSE_END
988db661
MK
26.\"
27.\" 2007-05-30 created by mtk, using text from old man.7 plus
04bc8827 28.\" rewrites and additional text.
ba83bc0d 29.\"
3df541c0 30.TH MAN-PAGES 7 2016-07-17 "Linux" "Linux Programmer's Manual"
ba83bc0d
MK
31.SH NAME
32man-pages \- conventions for writing Linux man pages
33.SH SYNOPSIS
34.B man
35.RI [ section ]
36.I title
37.SH DESCRIPTION
38This page describes the conventions that should be employed
39when writing man pages for the Linux \fIman-pages\fP project,
7aa48d58
MK
40which documents the user-space API provided by the Linux kernel
41and the GNU C library.
42The project thus provides most of the pages in Section 2,
0b920015
MK
43many of the pages that appear in Sections 3, 4, and 7,
44and a few of the pages that appear in Sections 1, 5, and 8
45of the man pages on a Linux system.
ba83bc0d
MK
46The conventions described on this page may also be useful
47for authors writing man pages for other projects.
c634028a 48.SS Sections of the manual pages
ba83bc0d
MK
49.PP
50The manual Sections are traditionally defined as follows:
ba83bc0d 51.TP 10
db6642bd 52.B 1 User commands (Programs)
ba83bc0d
MK
53Those commands that can be executed by the user from within
54a shell.
55.TP
56.B 2 System calls
db6642bd 57Those functions which wrap operations performed by the kernel.
ba83bc0d
MK
58.TP
59.B 3 Library calls
db6642bd
SA
60All library functions excluding the system call wrappers
61(Most of the
ba83bc0d 62.I libc
db6642bd 63functions).
ba83bc0d
MK
64.TP
65.B 4 Special files (devices)
66Files found in
db6642bd
SA
67.I /dev
68which allow to access to devices through the kernel.
ba83bc0d 69.TP
095f40d5 70.B 5 File formats and configuration files
db6642bd 71Describes various human-readable file formats and configuration files.
ba83bc0d
MK
72.TP
73.B 6 Games
db6642bd 74Games and funny little programs available on the system.
ba83bc0d 75.TP
d6aaae47 76.B 7 Overview, conventions, and miscellaneous
db6642bd
SA
77Overviews or descriptions of various topics, conventions and protocols,
78character set standards, the standard filesystem layout, and miscellaneous
79other things.
ba83bc0d
MK
80.TP
81.B 8 System management commands
82Commands like
83.BR mount (8),
84many of which only root can execute.
85.\" .TP
86.\" .B 9 Kernel routines
87.\" This is an obsolete manual section.
88.\" Once it was thought a good idea to document the Linux kernel here,
89.\" but in fact very little has been documented, and the documentation
90.\" that exists is outdated already.
91.\" There are better sources of
92.\" information for kernel developers.
ba83bc0d
MK
93.SS Macro package
94New manual pages should be marked up using the
add00eab 95.B groff an.tmac
ba83bc0d
MK
96package described in
97.BR man (7).
988db661 98This choice is mainly for consistency: the vast majority of
ba83bc0d
MK
99existing Linux manual pages are marked up using these macros.
100.SS Conventions for source file layout
988db661 101Please limit source code line length to no more than about 75 characters
ba83bc0d
MK
102wherever possible.
103This helps avoid line-wrapping in some mail clients when patches are
104submitted inline.
105
106New sentences should be started on new lines.
107This makes it easier to see the effect of patches,
108which often operate at the level of individual sentences.
109.SS Title line
aeb9b6a6
MK
110The first command in a man page should be a
111.B TH
112command:
ba83bc0d
MK
113.RS
114.sp
115.B \&.TH
0daa9e92 116.I "title section date source manual"
ba83bc0d
MK
117.sp
118.RE
119where:
120.RS
121.TP 10
122.I title
123The title of the man page, written in all caps (e.g.,
124.IR MAN-PAGES ).
125.TP
126.I section
127The section number in which the man page should be placed (e.g.,
128.IR 7 ).
129.TP
130.I date
1c4b22fb
MK
131The date of the last nontrivial change that was made to the man page.
132(Within the
133.I man-pages
0094f2b0 134project, the necessary updates to these timestamps are handled
1c4b22fb
MK
135automatically by scripts, so there is no need to manually update
136them as part of a patch.)
ba83bc0d
MK
137Dates should be written in the form YYYY-MM-DD.
138.TP
139.I source
140The source of the command, function, or system call.
ca92ce95 141
ba83bc0d
MK
142For those few \fIman-pages\fP pages in Sections 1 and 8,
143probably you just want to write
144.IR GNU .
ca92ce95 145
ba83bc0d
MK
146For system calls, just write
147.IR "Linux" .
148(An earlier practice was to write the version number
149of the kernel from which the manual page was being written/checked.
150However, this was never done consistently, and so was
151probably worse than including no version number.
152Henceforth, avoid including a version number.)
ca92ce95 153
988db661 154For library calls that are part of glibc or one of the
ba83bc0d
MK
155other common GNU libraries, just use
156.IR "GNU C Library" ", " GNU ,
157or an empty string.
ca92ce95 158
ba83bc0d
MK
159For Section 4 pages, use
160.IR "Linux" .
ca92ce95 161
ba83bc0d
MK
162In cases of doubt, just write
163.IR Linux ", or " GNU .
164.TP
165.I manual
988db661 166The title of the manual (e.g., for Section 2 and 3 pages in
ba83bc0d
MK
167the \fIman-pages\fP package, use
168.IR "Linux Programmer's Manual" ).
169.RE
170.SS Sections within a manual page
171The list below shows conventional or suggested sections.
988db661 172Most manual pages should include at least the
ba83bc0d
MK
173.B highlighted
174sections.
04bc8827 175Arrange a new manual page so that sections
ba83bc0d
MK
176are placed in the order shown in the list.
177.in +0.5i
178.nf
179
180\fBNAME\fP
181\fBSYNOPSIS\fP
1f901dc4 182CONFIGURATION [Normally only in Section 4]
ba83bc0d
MK
183\fBDESCRIPTION\fP
184OPTIONS [Normally only in Sections 1, 8]
185EXIT STATUS [Normally only in Sections 1, 8]
186RETURN VALUE [Normally only in Sections 2, 3]
187.\" May 07: Few current man pages have an ERROR HANDLING section,,,
188.\" ERROR HANDLING,
189ERRORS [Typically only in Sections 2, 3]
190.\" May 07: Almost no current man pages have a USAGE section,,,
988db661 191.\" USAGE,
25a46448 192.\" DIAGNOSTICS,
ba83bc0d
MK
193.\" May 07: Almost no current man pages have a SECURITY section,,,
194.\" SECURITY,
195ENVIRONMENT
196FILES
197VERSIONS [Normally only in Sections 2, 3]
a2dace6b 198ATTRIBUTES [Normally only in Sections 2, 3]
ba83bc0d
MK
199CONFORMING TO
200NOTES
201BUGS
202EXAMPLE
dcbc136a
MK
203.\" AUTHORS sections are discouraged
204.\" AUTHORS [Discouraged]
ba83bc0d
MK
205\fBSEE ALSO\fP
206
207.fi
208.in
209.IR "Where a traditional heading would apply" ", " "please use it" ;
210this kind of consistency can make the information easier to understand.
988db661 211If you must, you can create your own
ba83bc0d
MK
212headings if they make things easier to understand (this can
213be especially useful for pages in Sections 4 and 5).
214However, before doing this, consider whether you could use the
215traditional headings, with some subsections (\fI.SS\fP) within
216those sections.
217
988db661 218The following list elaborates on the contents of each of
ba83bc0d
MK
219the above sections.
220.TP 14
221.B NAME
222The name of this manual page.
9042e249 223
988db661 224See
ba83bc0d
MK
225.BR man (7)
226for important details of the line(s) that should follow the
25a46448 227\fB.SH NAME\fP command.
472926d8
MK
228All words in this line (including the word immediately
229following the "\\\-") should be in lowercase,
230except where English or technical terminological convention
231dictates otherwise.
ba83bc0d
MK
232.TP
233.B SYNOPSIS
9042e249
MK
234A brief summary of the command or function's interface.
235
ba83bc0d
MK
236For commands, this shows the syntax of the command and its arguments
237(including options);
04bc8827
MK
238boldface is used for as-is text and italics are used to
239indicate replaceable arguments.
ba83bc0d
MK
240Brackets ([]) surround optional arguments, vertical bars (|)
241separate choices, and ellipses (\&...) can be repeated.
242For functions, it shows any required data declarations or
243.B #include
244directives, followed by the function declaration.
d0e676ff
MK
245
246Where a feature test macro must be defined in order to obtain
247the declaration of a function (or a variable) from a header file,
248then the SYNOPSIS should indicate this, as described in
249.BR feature_test_macros (7).
e48efc84 250.\" FIXME . Say something here about compiler options
ba83bc0d 251.TP
c9890844
MK
252.B CONFIGURATION
253Configuration details for a device.
9042e249 254
33a0ccb2 255This section normally appears only in Section 4 pages.
c9890844 256.TP
ba83bc0d 257.B DESCRIPTION
9042e249
MK
258An explanation of what the program, function, or format does.
259
ba83bc0d
MK
260Discuss how it interacts with files and standard input, and what it
261produces on standard output or standard error.
262Omit internals and implementation details unless they're critical for
263understanding the interface.
264Describe the usual case;
265for information on command-line options of a program use the
266.B OPTIONS
267section.
268.\" If there is some kind of input grammar or complex set of subcommands,
269.\" consider describing them in a separate
270.\" .B USAGE
271.\" section (and just place an overview in the
272.\" .B DESCRIPTION
273.\" section).
3c4e1fb2
MK
274
275When describing new behavior or new flags for
276a system call or library function,
277be careful to note the kernel or C library version
278that introduced the change.
279The preferred method of noting this information for flags is as part of a
280.B .TP
281list, in the following form (here, for a new system call flag):
282.RS 22
283.TP
284.BR XYZ_FLAG " (since Linux 3.7)"
285Description of flag...
286.RE
287.IP
3d1ee497 288Including version information is especially useful to users
3c4e1fb2
MK
289who are constrained to using older kernel or C library versions
290(which is typical in embedded systems, for example).
ba83bc0d
MK
291.TP
292.B OPTIONS
9042e249 293A description of the command-line options accepted by a
ba83bc0d 294program and how they change its behavior.
9042e249 295
33a0ccb2 296This section should appear only for Section 1 and 8 manual pages.
ba83bc0d
MK
297.\" .TP
298.\" .B USAGE
299.\" describes the grammar of any sublanguage this implements.
ba83bc0d
MK
300.TP
301.B EXIT STATUS
9042e249 302A list of the possible exit status values of a program and
ba83bc0d 303the conditions that cause these values to be returned.
9042e249 304
33a0ccb2 305This section should appear only for Section 1 and 8 manual pages.
ba83bc0d
MK
306.TP
307.B RETURN VALUE
308For Section 2 and 3 pages, this section gives a
309list of the values the library routine will return to the caller
310and the conditions that cause these values to be returned.
311.TP
312.B ERRORS
313For Section 2 and 3 manual pages, this is a list of the
314values that may be placed in
315.I errno
316in the event of an error, along with information about the cause
317of the errors.
9042e249 318
09f49246 319.IR "The error list should be in alphabetical order" .
ba83bc0d
MK
320.TP
321.B ENVIRONMENT
9042e249 322A list of all environment variables that affect the program or function
ba83bc0d
MK
323and how they affect it.
324.TP
325.B FILES
9042e249 326A list of the files the program or function uses, such as
ba83bc0d
MK
327configuration files, startup files,
328and files the program directly operates on.
9042e249 329
ba83bc0d
MK
330Give the full pathname of these files, and use the installation
331process to modify the directory part to match user preferences.
332For many programs, the default installation location is in
333.IR /usr/local ,
334so your base manual page should use
335.I /usr/local
336as the base.
337.\" May 07: Almost no current man pages have a DIAGNOSTICS section;
338.\" "RETURN VALUE" or "EXIT STATUS" is preferred.
339.\" .TP
340.\" .B DIAGNOSTICS
341.\" gives an overview of the most common error messages and how to
342.\" cope with them.
343.\" You don't need to explain system error messages
344.\" or fatal signals that can appear during execution of any program
345.\" unless they're special in some way to the program.
346.\"
347.\" May 07: Almost no current man pages have a SECURITY section.
348.\".TP
349.\".B SECURITY
350.\"discusses security issues and implications.
351.\"Warn about configurations or environments that should be avoided,
352.\"commands that may have security implications, and so on, especially
353.\"if they aren't obvious.
354.\"Discussing security in a separate section isn't necessary;
355.\"if it's easier to understand, place security information in the
356.\"other sections (such as the
357.\" .B DESCRIPTION
358.\" or
359.\" .B USAGE
360.\" section).
361.\" However, please include security information somewhere!
362.TP
746e0af1 363.B ATTRIBUTES
361b7ac7
MK
364A summary of various attributes of the function(s) documented on this page.
365See
366.BR attributes (7)
367for further details.
746e0af1 368.TP
ba83bc0d
MK
369.B VERSIONS
370A brief summary of the Linux kernel or glibc versions where a
371system call or library function appeared,
372or changed significantly in its operation.
9042e249 373
294544e7
MK
374As a general rule, every new interface should
375include a VERSIONS section in its manual page.
376Unfortunately,
377many existing manual pages don't include this information
378(since there was no policy to do so when they were written).
379Patches to remedy this are welcome,
380but, from the perspective of programmers writing new code,
33a0ccb2 381this information probably matters only in the case of kernel
294544e7
MK
382interfaces that have been added in Linux 2.4 or later
383(i.e., changes since kernel 2.2),
384and library functions that have been added to glibc since version 2.1
385(i.e., changes since glibc 2.0).
386
387The
388.BR syscalls (2)
f4b5a0b0
MK
389manual page also provides information about kernel versions
390in which various system calls first appeared.
ba83bc0d
MK
391.TP
392.B CONFORMING TO
9042e249 393A description of any standards or conventions that relate to the function
04bc8827 394or command described by the manual page.
9042e249 395
7849287b
MK
396The preferred terms to use for the various standards are listed as
397headings in
398.BR standards (7).
9042e249 399
04bc8827
MK
400For a page in Section 2 or 3,
401this section should note the POSIX.1
402version(s) that the call conforms to,
403and also whether the call is specified in C99.
404(Don't worry too much about other standards like SUS, SUSv2, and XPG,
405or the SVr4 and 4.xBSD implementation standards,
406unless the call was specified in those standards,
407but isn't in the current version of POSIX.1.)
04bc8827 408
988db661
MK
409If the call is not governed by any standards but commonly
410exists on other systems, note them.
8382f16d 411If the call is Linux-specific, note this.
ebc2edd1
MK
412
413If this section consists of just a list of standards
414(which it commonly does),
415terminate the list with a period (\(aq.\(aq).
ba83bc0d
MK
416.TP
417.B NOTES
9042e249
MK
418Miscellaneous notes.
419
f8843c2e 420For Section 2 and 3 man pages you may find it useful to include
ba83bc0d 421subsections (\fBSS\fP) named \fILinux Notes\fP and \fIGlibc Notes\fP.
3a8bef11
MK
422
423In Section 2, use the heading
0722a578 424.I "C library/kernel differences"
3a8bef11 425to mark off notes that describe the differences (if any) between
ef4f4031 426the C library wrapper function for a system call and
3a8bef11 427the raw system call interface provided by the kernel.
ba83bc0d
MK
428.TP
429.B BUGS
9042e249 430A list of limitations, known defects or inconveniences,
ba83bc0d
MK
431and other questionable activities.
432.TP
433.B EXAMPLE
9042e249 434One or more examples demonstrating how this function, file or
ba83bc0d 435command is used.
9042e249 436
04bc8827
MK
437For details on writing example programs,
438see \fIExample Programs\fP below.
ba83bc0d 439.TP
dcbc136a 440.B AUTHORS
9042e249
MK
441A list of authors of the documentation or program.
442
dcbc136a 443\fBUse of an AUTHORS section is strongly discouraged\fP.
ba83bc0d
MK
444Generally, it is better not to clutter every page with a list
445of (over time potentially numerous) authors;
446if you write or significantly amend a page,
447add a copyright notice as a comment in the source file.
0cc32b69 448If you are the author of a device driver and want to include
f8843c2e 449an address for reporting bugs, place this under the BUGS section.
ba83bc0d
MK
450.TP
451.B SEE ALSO
9042e249 452A comma-separated list of related man pages, possibly followed by
ba83bc0d 453other related pages or documents.
9042e249
MK
454
455The list should be ordered by section number and
2b917159 456then alphabetically by name.
d2d136f7 457Do not terminate this list with a period.
c92b6bb5
MK
458.IP
459Where the SEE ALSO list contains many long manual page names,
460to improve the visual result of the output, it may be useful to employ the
461.I .ad l
462(don't right justify)
463and
464.I .nh
97776844 465(don't hyphenate)
c92b6bb5 466directives.
4eaa04c5 467Hyphenation of individual page names can be prevented
c92b6bb5 468by preceding words with the string "\\%".
aeb666ce
MK
469
470Given the distributed, autonomous nature of FOSS projects
471and their documentation, it is sometimes necessary\(emand in many cases
472desirable\(emthat the SEE ALSO section includes references to
473manual pages provided by other projects.
7849287b 474.SH STYLE GUIDE
9730fd84
MK
475The following subsections describe the preferred style for the
476.IR man-pages
7849287b
MK
477project.
478For details not covered below, the Chicago Manual of Style
9730fd84
MK
479is usually a good source;
480try also grepping for preexisting usage in the project source tree.
7849287b
MK
481.SS Use of gender-neutral language
482As far as possible, use gender-neutral language in the text of man
aa89a58e 483pages.
7849287b 484Use of "they" ("them", "themself", "their") as a gender-neutral singular
9730fd84 485pronoun is acceptable.
c0ada844
MK
486.\"
487.SS Formatting conventions for manual pages describing functions
ba83bc0d 488.PP
c0ada844
MK
489For manual pages that describe command (typically in Sections 1 and 8),
490the arguments are always specified using italics,
491.IR "even in the SYNOPSIS section" .
492
493The name of the command, and its options, should
494always be formatted in bold.
495.\"
496.SS Formatting conventions for manual pages describing functions
497For manual pages that describe functions (typically in Sections 2 and 3),
498the arguments are always specified using italics,
ba83bc0d
MK
499.IR "even in the SYNOPSIS section" ,
500where the rest of the function is specified in bold:
501.PP
ba83bc0d 502.BI " int myfunction(int " argc ", char **" argv );
ba83bc0d 503.PP
027ebd3c 504Variable names should, like argument names, be specified in italics.
c0ada844
MK
505
506Any reference to the subject of the current manual page
507should be written with the name in bold followed by
508a pair of parentheses in Roman (normal) font.
509For example, in the
510.BR fcntl (2)
511man page, references to the subject of the page would be written as:
512.BR fcntl ().
513The preferred way to write this in the source file is:
514.nf
515
516 .BR fcntl ()
517
518.fi
519(Using this format, rather than the use of "\\fB...\\fP()"
520makes it easier to write tools that parse man page source files.)
521.\"
522.SS Formatting conventions (general)
9730fd84 523Filenames (whether pathnames, or references to header files)
fc573e5f
MK
524are always in italics (e.g.,
525.IR <stdio.h> ),
ba83bc0d
MK
526except in the SYNOPSIS section, where included files are in bold (e.g.,
527.BR "#include <stdio.h>" ).
9730fd84 528When referring to a standard header file include,
f36234fa
MK
529specify the header file surrounded by angle brackets,
530in the usual C way (e.g.,
ab9616d3 531.IR <stdio.h> ).
ba83bc0d 532.PP
efaef3da 533Special macros, which are usually in uppercase, are in bold (e.g.,
ba83bc0d
MK
534.BR MAXINT ).
535Exception: don't boldface NULL.
536.PP
537When enumerating a list of error codes, the codes are in bold (this list
538usually uses the
539.B \&.TP
540macro).
c0ada844 541
027ebd3c 542Complete commands should, if long,
9730fd84
MK
543be written as an indented line on their own,
544with a blank line before and after the command, for example
027ebd3c
MK
545.in +4n
546.nf
547
548man 7 man-pages
549
550.fi
551.in
a4f844c6 552If the command is short, then it can be included inline in the text,
027ebd3c
MK
553in italic format, for example,
554.IR "man 7 man-pages" .
24b74457 555In this case, it may be worth using nonbreaking spaces
31a6818e 556("\e\ ") at suitable places in the command.
10850212
MK
557Command options should be written in italics (e.g.,
558.IR \-l ).
027ebd3c
MK
559.PP
560Expressions, if not written on a separate indented line, should
561be specified in italics.
24b74457 562Again, the use of nonbreaking spaces may be appropriate
027ebd3c 563if the expression is inlined with normal text.
ba83bc0d 564
c0ada844 565When showing example shell sessions, user input should be formatted in bold, for example
ba83bc0d 566
c0ada844
MK
567.nf
568.in +4n
569 $ \fBdate\fP
570 Thu Jul 7 13:01:27 CEST 2016
571.in
ba83bc0d 572.fi
ba83bc0d
MK
573.PP
574Any reference to another man page
575should be written with the name in bold,
aeb9b6a6
MK
576.I always
577followed by the section number,
ba83bc0d
MK
578formatted in Roman (normal) font, without any
579separating spaces (e.g.,
580.BR intro (2)).
581The preferred way to write this in the source file is:
582.nf
583
584 .BR intro (2)
585
586.fi
587(Including the section number in cross references lets tools like
588.BR man2html (1)
589create properly hyperlinked pages.)
7849287b
MK
590
591Control characters should be written in bold face,
592with no quotes; for example,
593.BR ^X .
55f7ee2a 594.SS Spelling
9daed026 595Starting with release 2.59,
55f7ee2a 596.I man-pages
91e4f660 597follows American spelling conventions
7849287b 598(previously, there was a random mix of British and American spellings);
55f7ee2a 599please write all new pages and patches according to these conventions.
7849287b
MK
600
601Aside from the well-known spelling differences,
602there are a few other subtleties to watch for:
603.IP * 3
28aac7d7 604American English tends to use the forms "backward", "upward", "toward",
7849287b 605and so on
28aac7d7 606rather than the British forms "backwards", "upwards", "towards", and so on.
7849287b
MK
607.SS BSD version numbers
608The classical scheme for writing BSD version numbers is
609.IR x.yBSD ,
610where
611.I x.y
612is the version number (e.g., 4.2BSD).
613Avoid forms such as
614.IR "BSD 4.3" .
159f0403 615.SS Capitalization
7849287b 616In subsection ("SS") headings,
efaef3da 617capitalize the first word in the heading, but otherwise use lowercase,
159f0403
MK
618except where English usage (e.g., proper nouns) or programming
619language requirements (e.g., identifier names) dictate otherwise.
09e311c5 620For example:
9730fd84
MK
621
622 .SS Unicode under Linux
787dd4ad 623.\"
f78ed33a 624.SS Indentation of structure definitions, shell session logs, and so on
7849287b
MK
625When structure definitions, shell session logs, and so on are included
626in running text, indent them by 4 spaces (i.e., a block enclosed by
627.I ".in\ +4n"
628and
629.IR ".in" ).
630.SS Preferred terms
631The following table lists some preferred terms to use in man pages,
632mainly to ensure consistency across pages.
7849287b
MK
633.TS
634l l l
635---
636l l l.
637Term Avoid using Notes
638
639bit mask bitmask
640built-in builtin
641Epoch epoch T{
642For the UNIX Epoch (00:00:00, 1 Jan 1970 UTC)
643T}
644filename file name
9730fd84 645filesystem file system
7849287b
MK
646hostname host name
647inode i-node
a6ce0ba5 648lowercase lower case, lower-case
7849287b
MK
649pathname path name
650pseudoterminal pseudo-terminal
651privileged port T{
652reserved port,
653system port
654T}
655real-time T{
656realtime,
4a6cd1db 657real time
7849287b
MK
658T}
659run time runtime
660saved set-group-ID T{
661saved group ID,
662saved set-GID
663T}
664saved set-user-ID T{
665saved user ID,
666saved set-UID
667T}
668set-group-ID set-GID, setgid
669set-user-ID set-UID, setuid
670superuser T{
671super user,
672super-user
673T}
644ee9c7
MK
674superblock T{
675super block,
676super-block
677T}
7849287b
MK
678timestamp time stamp
679timezone time zone
a6ce0ba5 680uppercase upper case, upper-case
e03fae06 681usable useable
7849287b
MK
682user space userspace
683username user name
684zeros zeroes
685.TE
4a6cd1db
DP
686.PP
687See also the discussion
9730fd84
MK
688.IR "Hyphenation of attributive compounds"
689below.
7849287b
MK
690.SS Terms to avoid
691The following table lists some terms to avoid using in man pages,
692along with some suggested alternatives,
693mainly to ensure consistency across pages.
7849287b
MK
694.TS
695l l l
696---
697l l l.
698Avoid Use instead Notes
699
9730fd84
MK
70032bit 32-bit T{
701same for 8-bit, 16-bit, etc.
702T}
7849287b
MK
703current process calling process T{
704A common mistake made by kernel programmers when writing man pages
705T}
706manpage T{
707man page, manual page
708T}
709minus infinity negative infinity
710non-root unprivileged user
711non-superuser unprivileged user
712nonprivileged unprivileged
713OS operating system
714plus infinity positive infinity
715pty pseudoterminal
7849287b
MK
716tty terminal
717Unices UNIX systems
718Unixes UNIX systems
719.TE
7849287b 720.SS Trademarks
aa89a58e
MK
721Use the correct spelling and case for trademarks.
722The following is a list of the correct spellings of various
7849287b
MK
723relevant trademarks that are sometimes misspelled:
724
725 DG/UX
726 HP-UX
727 UNIX
728 UnixWare
729.SS NULL, NUL, null pointer, and null character
730A
731.IR "null pointer"
732is a pointer that points to nothing,
733and is normally indicated by the constant
734.IR NULL .
735On the other hand,
736.I NUL
737is the
738.IR "null byte",
739a byte with the value 0, represented in C via the character constant
740.IR \(aq\e0\(aq .
741
742The preferred term for the pointer is "null pointer" or simply "NULL";
743avoid writing "NULL pointer".
744
745The preferred term for the byte is "null byte".
746Avoid writing "NUL", since it is too easily confused with "NULL".
747Avoid also the terms "zero byte" and "null character".
748The byte that terminates a C string should be described
749as "the terminating null byte";
750strings may be described as "null-terminated",
751but avoid the use of "NUL-terminated".
752.SS Hyperlinks
753For hyperlinks, use the
754.IR .UR / .UE
755macro pair
756(see
757.BR groff_man (7)).
758This produces proper hyperlinks that can be used in a web browser,
759when rendering a page with, say:
760
761 BROWSER=firefox man -H pagename
762.SS Use of e.g., i.e., etc., a.k.a., and similar
763In general, the use of abbreviations such as "e.g.", "i.e.", "etc.", "a.k.a."
764should be avoided, in favor of suitable full wordings
765("for example", "that is", "and so on", "also known as").
766
767The only place where such abbreviations may be acceptable is in
768.I short
769parenthetical asides (e.g., like this one).
770
771Always include periods in such abbreviations, as shown here.
772In addition, "e.g." and "i.e." should always be followed by a comma.
773.SS Em-dashes
9730fd84
MK
774The way to write an em-dash\(emthe glyph that appears
775at either end of this subphrase\(emin *roff is with the macro "\\(em".
776(On an ASCII terminal, an em-dash typically renders as two hyphens,
777but in other typographical contexts it renders as a long dash.)
7849287b
MK
778Em-dashes should be written
779.I without
780surrounding spaces.
781.SS Hyphenation of attributive compounds
aa89a58e 782Compound terms should be hyphenated when used attributively
4a6cd1db 783(i.e., to qualify a following noun). Some examples:
7849287b 784
9730fd84 785 32-bit value
7849287b
MK
786 command-line argument
787 floating-point number
788 run-time check
789 user-space function
790 wide-character string
791.SS Hyphenation with multi, non, pre, re, sub, and so on
792The general tendency in modern English is not to hyphenate
793after prefixes such as "multi", "non", "pre", "re", "sub", and so on.
794Manual pages should generally follow this rule when these prefixes are
795used in natural English constructions with simple suffixes.
796The following list gives some examples of the preferred forms:
797
798 interprocess
799 multithreaded
800 multiprocess
801 nonblocking
802 nondefault
803 nonempty
804 noninteractive
805 nonnegative
806 nonportable
807 nonzero
808 preallocated
809 precreate
810 prerecorded
811 reestablished
812 reinitialize
813 rearm
814 reread
815 subcomponent
816 subdirectory
817 subsystem
818
819Hyphens should be retained when the prefixes are used in nonstandard
820English words, with trademarks, proper nouns, acronyms, or compound terms.
821Some examples:
822
823 non-ASCII
824 non-English
825 non-NULL
826 non-real-time
827
828Finally, note that "re-create" and "recreate" are two different verbs,
829and the former is probably what you want.
9f0e82b4
MK
830.SS Real minus character
831Where a real minus character is required (e.g., for numbers such as \-1,
9730fd84
MK
832or when writing options that have a leading dash, such as in
833.IR "ls\ \-l"),
4a6cd1db 834use the following form in the man page source:
7849287b
MK
835
836 \\-
837
838This guideline applies also to code examples.
839.SS Character constants
840To produce single quotes that render well in both ASCII and UTF-8,
841use the following form for character constants in the man page source:
842
843 \\(aqC\\(aq
844
845where
846.I C
847is the quoted character.
848This guideline applies also to character constants used in code examples.
c634028a 849.SS Example programs and shell sessions
9730fd84 850Manual pages may include example programs demonstrating how to
ba83bc0d
MK
851use a system call or library function.
852However, note the following:
f78f2def 853.IP * 3
ba83bc0d 854Example programs should be written in C.
f78f2def 855.IP *
33a0ccb2 856An example program is necessary and useful only if it demonstrates
ba83bc0d
MK
857something beyond what can easily be provided in a textual
858description of the interface.
859An example program that does nothing
860other than call an interface usually serves little purpose.
f78f2def 861.IP *
c04c44f8
MK
862Example programs should be fairly short (preferably less than 100 lines;
863ideally less than 50 lines).
f78f2def 864.IP *
ba83bc0d
MK
865Example programs should do error checking after system calls and
866library function calls.
f78f2def 867.IP *
ba83bc0d 868Example programs should be complete, and compile without
5b8dbfd4 869warnings when compiled with \fIcc\ \-Wall\fP.
f78f2def 870.IP *
ba83bc0d 871Where possible and appropriate, example programs should allow
d9bfdb9c 872experimentation, by varying their behavior based on inputs
ba83bc0d
MK
873(ideally from command-line arguments, or alternatively, via
874input read by the program).
f78f2def 875.IP *
ba83bc0d 876Example programs should be laid out according to Kernighan and
5998eb25 877Ritchie style, with 4-space indents.
ba83bc0d 878(Avoid the use of TAB characters in source code!)
b1f800c6 879The following command can be used to format your source code to
d0b8a20c 880something close to the preferred style:
b1f800c6 881
d0b8a20c 882 indent \-npro \-kr \-i4 \-ts4 \-sob \-l72 \-ss \-nut \-psl prog.c
f78f2def 883.IP *
4a6cd1db 884For consistency, all example programs should terminate using either of:
7849287b
MK
885
886 exit(EXIT_SUCCESS);
887 exit(EXIT_FAILURE);
888
889Avoid using the following forms to terminate a program:
890
891 exit(0);
892 exit(1);
893 return n;
894.IP *
f78f2def
MK
895If there is extensive explanatory text before the
896program source code, mark off the source code
d50ee7fb 897with a subsection heading
f78f2def
MK
898.IR "Program source" ,
899as in:
900
901 .SS Program source
902
903Always do this if the explanatory text includes a shell session log.
904.PP
905If you include a shell session log demonstrating the use of a program
906or other system feature:
907.IP * 3
908Place the session log above the source code listing
909.IP *
910Indent the session log by four spaces.
911.IP *
912Boldface the user input text,
913to distinguish it from output produced by the system.
ba83bc0d
MK
914.PP
915For some examples of what example programs should look like, see
916.BR wait (2)
917and
918.BR pipe (2).
919.SH EXAMPLE
920For canonical examples of how man pages in the
0daa9e92 921.I man-pages
ba83bc0d
MK
922package should look, see
923.BR pipe (2)
924and
925.BR fcntl (2).
926.SH SEE ALSO
927.BR man (1),
928.BR man2html (1),
5e511b39 929.BR attributes (7),
976093f0
MK
930.BR groff (7),
931.BR groff_man (7),
ba83bc0d
MK
932.BR man (7),
933.BR mdoc (7)