]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/man.7
wfix
[thirdparty/man-pages.git] / man7 / man.7
CommitLineData
fea681da
MK
1.\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
2.\" (faith@cs.unc.edu and dwheeler@ida.org)
3.\"
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
12.\"
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
20.\"
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
23.\"
24.\" Modified Sun Jul 25 11:06:05 1993 by Rik Faith (faith@cs.unc.edu)
25.\" Modified Sat Jun 8 00:39:52 1996 by aeb
26.\" Modified Wed Jun 16 23:00:00 1999 by David A. Wheeler (dwheeler@ida.org)
27.\" Modified Thu Jul 15 12:43:28 1999 by aeb
28.\" [todo: split this into man.7 describing the macros
29.\" and manpage.7 describing the Linux man page conventions]
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.\"
33.TH MAN 7 2004-07-27 "Linux" "Linux Programmer's Manual"
34.SH NAME
35man \- macros to format man pages
36.SH SYNOPSIS
37.B groff \-Tascii \-man
38.I file
39\&...
40.LP
41.B groff \-Tps \-man
42.I file
43\&...
44.LP
45.B man
46.RI [ section ]
47.I title
48.SH DESCRIPTION
49This manual page explains the
50.B "groff tmac.an"
51macro package (often called the
52.B man
53macro package) and related conventions for creating manual (man) pages.
54This macro package should be used by developers when
55writing or porting man pages for Linux. It is fairly compatible with other
56versions of this macro package, so porting man pages should not be a major
57problem (exceptions include the NET-2 BSD release, which uses a totally
58different macro package called mdoc; see
59.BR mdoc (7)).
60.PP
61Note that NET-2 BSD mdoc man pages can be used with
62.B groff
63simply by specifying the
64.B \-mdoc
65option instead of the
66.B \-man
67option. Using the
68.B \-mandoc
69option is, however, recommended, since this will automatically detect which
70macro package is in use.
71.SH PREAMBLE
72The first command in a man page (after comment lines) should be
73.RS
74.sp
75.B \&.TH
76.IR "title section date source manual" ,
77.sp
78.RE
79where:
80.RS
81.TP 10
82.I title
83The title of the man page (e.g.,
84.IR MAN ).
85.TP
86.I section
87The section number the man page should be placed in (e.g.,
88.IR 7 ).
89.TP
90.I date
91The date of the last revision\(emremember to change this every time a
92change is made to the man page, since this is the most general way of doing
93version control.
94.TP
95.I source
96The source of the command.
97.sp
98For binaries, use something like:
99.IR GNU ", " NET-2 ", " "SLS Distribution" ", " "MCC Distribution" .
100.sp
101For system calls, use the version of the kernel that you are currently
102looking at:
103.IR "Linux 0.99.11" .
104.sp
105For library calls, use the source of the function:
b14d4aa5 106.IR GNU ", " "4.3BSD" ", " "Linux DLL 4.4.1" .
fea681da
MK
107.TP
108.I manual
109The title of the manual (e.g.,
110.IR "Linux Programmer's Manual" ).
111.RE
112.PP
113Note that BSD mdoc-formatted pages begin with the
114.B Dd
115command, not the
116.B TH
117command.
118.PP
119The manual sections are traditionally defined as follows:
120.RS
121.TP 10
122.B 1 Commands
123Those commands that can be executed by the user from within
124a shell.
125.TP
126.B 2 System calls
127Those functions which must be performed by the kernel.
128.TP
129.B 3 Library calls
130Most of the
131.I libc
132functions, such as
133.BR qsort (3).
134.TP
135.B 4 Special files
136Files found in
137.IR /dev .
138.TP
139.B 5 File formats and conventions
140The format for
141.I /etc/passwd
142and other human-readable files.
143.TP
144.B 6 Games
145.TP
146.B 7 Conventions and miscellaneous
147A description of the standard file system layout, network protocols,
148ASCII and other character codes, this man page, and other things.
149.TP
150.B 8 System management commands
151Commands like
152.BR mount (8),
153many of which only root can execute.
154.TP
155.B 9 Kernel routines
156This is an obsolete manual section.
157Once it was thought a good idea to document the Linux kernel here,
158but in fact very little has been documented, and the documentation
159that exists is outdated already. There are better sources of
160information for kernel developers.
161.RE
162.SH SECTIONS
163Sections are started with
164.B \&.SH
165followed by the heading name. If the name contains spaces and appears
166on the same line as
167.BR \&.SH ,
168then place the heading in double quotes. Traditional or suggested
169headings include:
170NAME, SYNOPSIS, DESCRIPTION, RETURN VALUE,
171EXIT STATUS, ERROR HANDLING, ERRORS,
172OPTIONS, USAGE, EXAMPLES, FILES, ENVIRONMENT, DIAGNOSTICS, SECURITY,
173CONFORMING TO, NOTES, BUGS, AUTHOR, and SEE ALSO.
174Where a traditional heading would apply, please use it;
175this kind of consistency can make the information easier to understand.
176However, feel free to create your own headings if they make things easier
177to understand.
178The only required heading is NAME, which should be the first section and
179be followed on the next line by a one line description of the program:
180.RS
181.sp
182\&.SH NAME
183.br
184chess \\- the game of chess
185.sp
186.RE
187It is extremely important that this format is followed, and that there is a
188backslash before the single dash which follows the command name. This
189syntax is used by the
190.BR makewhatis (8)
191program to create a database of short command descriptions for the
192.BR whatis (1)
193and
194.BR apropos (1)
195commands.
196.PP
197Some other traditional sections have the following contents:
198.TP 14
199.B SYNOPSIS
200briefly describes the command or function's interface.
201For commands, this shows the syntax of the command and its arguments
202(including options);
203boldface is used for as-is text and italics are used to indicate replaceable
204arguments. Brackets ([]) surround optional arguments, vertical bars (|)
205separate choices, and ellipses (\&...) can be repeated.
206For functions, it shows any required data declarations or
207.B #include
208directives, followed by the function declaration.
209.TP
210.B DESCRIPTION
211gives an explanation of what the command, function, or format does.
212Discuss how it interacts with files and standard input, and what it
213produces on standard output or standard error.
214Omit internals and implementation details unless they're critical for
215understanding the interface.
216Describe the usual case; for information on options use the
217.B OPTIONS
218section.
219If there is some kind of input grammar or complex set of subcommands,
220consider describing them in a separate
221.B USAGE
222section (and just place an overview in the
223.B DESCRIPTION
224section).
225.TP
226.B RETURN VALUE
227gives a
228list of the values the library routine will return to the caller
229and the conditions that cause these values to be returned.
230.TP
231.B EXIT STATUS
232lists the possible exit status values or a program and
233the conditions that cause these values to be returned.
234.TP
235.B OPTIONS
236describes the options accepted by the program and how they change
237its behavior.
238.TP
239.B USAGE
240describes the grammar of any sublanguage this implements.
241.TP
242.B EXAMPLES
243provides one or more examples describing how this function, file or
244command is used.
245.TP
246.B FILES
247lists the files the program or function uses, such as
248configuration files, startup files,
249and files the program directly operates on.
250Give the full pathname of these files, and use the installation
251process to modify the directory part to match user preferences.
252For many programs, the default installation location is in
253.IR /usr/local ,
254so your base manual page should use
255.I /usr/local
256as the base.
257.TP
258.B ENVIRONMENT
259lists all environment variables that affect your program or function
260and how they affect it.
261.TP
262.B DIAGNOSTICS
263gives an overview of the most common error messages and how to
264cope with them. You don't need to explain system error messages
265or fatal signals that can appear during execution of any program
266unless they're special in some way to your program.
267.TP
268.B SECURITY
269discusses security issues and implications.
270Warn about configurations or environments that should be avoided,
271commands that may have security implications, and so on, especially
272if they aren't obvious.
273Discussing security in a separate section isn't necessary;
274if it's easier to understand, place security information in the
275other sections (such as the
276.B DESCRIPTION
277or
278.B USAGE
279section).
280However, please include security information somewhere!
281.TP
282.B CONFORMING TO
283describes any standards or conventions this implements.
284.TP
285.B NOTES
286provides miscellaneous notes.
287.TP
288.B BUGS
289lists limitations, known defects or inconveniences,
290and other questionable activities.
291.TP
292.B AUTHOR
293lists authors of the documentation or program so you can mail in bug
294reports.
295.TP
296.B SEE ALSO
297lists related man pages in alphabetical order, possibly followed by
298other related pages or documents.
299Conventionally this is the last section.
300.SH FONTS
301Although there are many arbitrary conventions for man pages in the UNIX
302world, the existence of several hundred Linux-specific man pages defines our
303font standards:
304.IP
305For functions, the arguments are always specified using italics,
306.IR "even in the SYNOPSIS section" ,
307where the rest of the function is specified in bold:
308.RS
309.BI "int myfunction(int " argc ", char **" argv );
310.RE
311.IP
312Filenames are always in italics (e.g.,
313.IR "/usr/include/stdio.h" ),
314except in the SYNOPSIS section, where included files are in bold (e.g.,
315.BR "#include <stdio.h>" ).
316.IP
317Special macros, which are usually in upper case, are in bold (e.g.,
318.BR MAXINT ).
319.IP
320When enumerating a list of error codes, the codes are in bold (this list
321usually uses the
322.B \&.TP
323macro).
324.IP
325Any reference to another man page (or to the subject of the current man
326page) is in bold. If the manual section number is given, it is given in
327Roman (normal) font, without any spaces (e.g.,
328.BR man (7)).
329.LP
330The commands to select the type face are:
331.TP 4
332.B \&.B
333Bold
334.TP
335.B \&.BI
336Bold alternating with italics
337(especially useful for function specifications)
338.TP
339.B \&.BR
340Bold alternating with Roman
341(especially useful for referring to other
342manual pages)
343.TP
344.B \&.I
345Italics
346.TP
347.B \&.IB
348Italics alternating with bold
349.TP
350.B \&.IR
351Italics alternating with Roman
352.TP
353.B \&.RB
354Roman alternating with bold
355.TP
356.B \&.RI
357Roman alternating with italics
358.TP
359.B \&.SB
360Small alternating with bold
361.TP
362.B \&.SM
363Small (useful for acronyms)
364.LP
365Traditionally, each command can have up to six arguments, but the GNU
366implementation removes this limitation (you might still want to limit
367yourself to 6 arguments for portability's sake).
368Arguments are delimited by
369spaces. Double quotes can be used to specify an argument which contains
370spaces. All of the arguments will be printed next to each other without
371intervening spaces, so that the
372.B \&.BR
373command can be used to specify a word in bold followed by a mark of
374punctuation in Roman.
375If no arguments are given, the command is applied to the following line
376of text.
377.SH "OTHER MACROS AND STRINGS"
378.PP
379Below are other relevant macros and predefined strings.
380Unless noted otherwise, all macros
381cause a break (end the current line of text).
382Many of these macros set or use the "prevailing indent."
383The "prevailing indent" value is set by any macro with the parameter
384.I i
385below;
386macros may omit
387.I i
388in which case the current prevailing indent will be used.
389As a result, successive indented paragraphs can use the same indent without
390re-specifying the indent value.
391A normal (non-indented) paragraph resets the prevailing indent value
392to its default value (0.5 inches).
393By default a given indent is measured in ens; try to ens or ems as units for
394indents, since these will automatically adjust to font size changes.
395The other key macro definitions are:
396.SS "Normal Paragraphs"
397.TP 9m
398.B \&.LP
399Same as
400.B \&.PP
401(begin a new paragraph).
402.TP
403.B \&.P
404Same as
405.B \&.PP
406(begin a new paragraph).
407.TP
408.B \&.PP
409Begin a new paragraph and reset prevailing indent.
410.SS "Relative Margin Indent"
411.TP 9m
412.BI \&.RS " i"
4d9b6984 413Start relative margin indent: moves the left margin
fea681da
MK
414.I i
415to the right (if
416.I i
417is omitted, the prevailing indent value is used).
418A new prevailing indent is set to 0.5 inches.
419As a result, all following paragraph(s) will be
420indented until the corresponding
421.BR \&.RE .
422.TP
423.B \&.RE
424End relative margin indent and
425restores the previous value of the prevailing indent.
426.SS "Indented Paragraph Macros"
427.TP 9m
428.BI \&.HP " i"
429Begin paragraph with a hanging indent
430(the first line of the paragraph is at the left margin of
431normal paragraphs, and the rest of the paragraph's lines are indented).
432.TP
433.BI \&.IP " x i"
434Indented paragraph with optional hanging tag.
435If the tag
436.I x
437is omitted, the entire following paragraph is indented by
438.IR i .
439If the tag
440.I x
441is provided, it is hung at the left margin
442before the following indented paragraph
443(this is just like
444.BR \&.TP
445except the tag is included with the command instead of being on the
446following line).
447If the tag is too long, the text after the tag will be moved down to the
448next line (text will not be lost or garbled).
449For bulleted lists, use this macro with \e(bu (bullet) or \e(em (em dash)
450as the tag, and for numbered lists, use the number or letter followed by
451a period as the tag;
452this simplifies translation to other formats.
453.TP
454.BI \&.TP " i"
455Begin paragraph with hanging tag. The tag is given on the next line, but
456its results are like those of the
457.B \&.IP
458command.
459.SS "Hypertext Link Macros"
dd1b9170
MK
460(Feature supported with
461.B groff
462only.)
fea681da
MK
463In order to use hypertext link macros, it is necessary to load the
464.B www.tmac
465macro package.
466Use the request
467.B .mso www.tmac
468to do this.
469.TP 9m
470.BI \&.URL " url link trailer"
471Inserts a hypertext link to the URI (URL)
472.IR url ,
473with
474.I link
475as the text of the link.
476The
477.I trailer
478will be printed immediately afterwards.
479When generating HTML this should translate into the HTML command
480\fB<A HREF="\fP\fIurl\fP\fB">\fIlink\fP\fB</A>\fP\fItrailer\fP.
481.\" The following is a kludge to get a paragraph into the listing.
482.TP
483.B " "
484This and other related macros are new, and
485many tools won't do anything with them, but
486since many tools (including troff) will simply ignore undefined macros
487(or at worst insert their text) these are safe to insert.
dd1b9170
MK
488.\" The following is a kludge to get a paragraph into the listing.
489.TP
490.B " "
491It can be useful to define your own
492.B URL
493macro in manual pages for the benefit of those viewing it with a roff
494viewer other than
495.BR groff .
496That way, the URL, link text, and trailer text (if any) are still visible.
497.\" The following is a kludge to get a paragraph into the listing.
498.TP
499.B " "
500Here's an example:
501.RS 1.5i
502\&.de URL
503.br
504\\\\$2 \\(laURL: \\\\$1 \\(ra\\\\$3
505.br
506\&..
507.br
508\&.if \\n[.g] .mso www.tmac
509.br
510\&.TH
511.I ...
512.br
513.I (later in the page)
514.br
515This software comes from the
516.br
517\&.URL "http://www.gnu.org/" "GNU Project" " of the"
518.br
519\&.URL "http://www.fsf.org/" "Free Software Foundation" .
520.RE
521.\" The following is a kludge to get a paragraph into the listing.
522.TP
523.B " "
524In the above, if
525.B groff
526is being used, the
527.B www.tmac
528macro package's definition of the URL macro will supersede the locally
529defined one.
fea681da
MK
530.PP
531A number of other link macros are available. See
532.BR groff_www (7)
533for more details.
534.SS "Miscellaneous Macros"
535.TP 9m
536.B \&.DT
537Reset tabs to default tab values (every 0.5 inches);
538does not cause a break.
539.TP
540.BI \&.PD " d"
541Set inter-paragraph vertical distance to d
542(if omitted, d=0.4v);
543does not cause a break.
544.TP
545.BI \&.SS " t"
546Subheading
547.I t
548(like
549.BR \&.SH ,
550but used for a subsection inside a section).
551.SS "Predefined Strings"
552The
553.B man
554package has the following predefined strings:
555.IP \e*R
556Registration Symbol: \*R
557.IP \e*S
558Change to default font size
559.IP \e*(Tm
560Trademark Symbol: \*(Tm
561.IP \e*(lq
562Left angled doublequote: \*(lq
563.IP \e*(rq
564Right angled doublequote: \*(rq
565.SH "SAFE SUBSET"
566Although technically
567.B man
568is a troff macro package, in reality a large number of other tools
569process man page files that don't implement all of troff's abilities.
570Thus, it's best to avoid some of troff's more exotic abilities where possible
571to permit these other tools to work correctly.
572Avoid using the various troff preprocessors
573(if you must, go ahead and use
574.BR tbl (1),
575but try to use the
576.B IP
577and
578.B TP
579commands instead for two-column tables).
580Avoid using computations; most other tools can't process them.
581Use simple commands that are easy to translate to other formats.
582The following troff macros are believed to be safe (though in many cases
583they will be ignored by translators):
584.BR \e" ,
585.BR . ,
586.BR ad ,
587.BR bp ,
588.BR br ,
589.BR ce ,
590.BR de ,
591.BR ds ,
592.BR el ,
593.BR ie ,
594.BR if ,
595.BR fi ,
596.BR ft ,
597.BR hy ,
598.BR ig ,
599.BR in ,
600.BR na ,
601.BR ne ,
602.BR nf ,
603.BR nh ,
604.BR ps ,
605.BR so ,
606.BR sp ,
607.BR ti ,
608.BR tr .
609.PP
610You may also use many troff escape sequences (those sequences beginning
611with \e).
612When you need to include the backslash character as normal text,
613use \ee.
614Other sequences you may use, where x or xx are any characters and N
615is any digit, include:
616.BR \e' ,
617.BR \e` ,
618.BR \e- ,
619.BR \e. ,
620.BR \e" ,
621.BR \e% ,
622.BR \e*x ,
623.BR \e*(xx ,
624.BR \e(xx ,
625.BR \e$N ,
626.BR \enx ,
627.BR \en(xx ,
628.BR \efx ,
629and
630.BR \ef(xx .
631Avoid using the escape sequences for drawing graphics.
632.PP
633Do not use the optional parameter for
634.B bp
635(break page).
636Use only positive values for
637.B sp
638(vertical space).
639Don't define a macro
640.RB ( de )
641with the same name as a macro in this or the
642mdoc macro package with a different meaning; it's likely that
643such redefinitions will be ignored.
644Every positive indent
645.RB ( in )
646should be paired with a matching negative indent
647(although you should be using the
648.B RS
649and
650.B RE
651macros instead).
652The condition test
653.RB ( if,ie )
654should only have 't' or 'n' as the condition.
655Only translations
656.RB ( tr )
657that can be ignored should be used.
658Font changes
659.RB ( ft
660and the \fB\ef\fP escape sequence)
661should only have the values 1, 2, 3, 4, R, I, B, P, or CW
662(the ft command may also have no parameters).
663.PP
664If you use capabilities beyond these, check the
665results carefully on several tools.
666Once you've confirmed that the additional capability is safe,
667let the maintainer of this
668document know about the safe command or sequence
669that should be added to this list.
670.SH NOTES
671.PP
672By all means include full URLs (or URIs) in the text itself;
673some tools such as
674.BR man2html (1)
675can automatically turn them into hypertext links.
676You can also use the new
677.B URL
678macro to identify links to related information.
679If you include URLs, use the full URL
680(e.g., <http://www.kernelnotes.org>) to ensure that tools
681can automatically find the URLs.
682.PP
683Tools processing these files should open the file and examine the first
684non-whitespace character. A period (.) or single quote (')
685at the beginning of a line indicates a troff-based file (such as man or mdoc).
686A left angle bracket (<) indicates an SGML/XML-based
687file (such as HTML or Docbook). Anything else suggests simple ASCII
688text (e.g., a "catman" result).
689.PP
690Many man pages begin with '\e" followed by a space and a list of characters,
691indicating how the page is to be preprocessed.
692For portability's sake to non-troff translators we recommend that you avoid
693using anything other than
694.BR tbl (1),
695and Linux can detect that automatically.
696However, you might want to include this information so your man page
697can be handled by other (less capable) systems.
698Here are the definitions of the preprocessors invoked by these characters:
699.TP 3
700.B e
701eqn(1)
702.TP
703.B g
704grap(1)
705.TP
706.B p
707pic(1)
708.TP
709.B r
710refer(1)
711.TP
712.B t
713tbl(1)
714.TP
715.B v
716vgrind(1)
717.SH FILES
718.IR /usr/share/groff/ [*/] tmac/tmac.an
719.br
720.I /usr/man/whatis
721.SH BUGS
722.PP
723Most of the macros describe formatting (e.g., font type and spacing) instead
724of marking semantic content (e.g., this text is a reference to another page),
725compared to formats like mdoc and DocBook (even HTML has more semantic
726markings).
727This situation makes it harder to vary the
728.B man
729format for different media,
730to make the formatting consistent for a given media, and to automatically
731insert cross-references.
732By sticking to the safe subset described above, it should be easier to
733automate transitioning to a different reference page format in the future.
734.LP
735The Sun macro
736.B TX
737is not implemented.
738.SH AUTHORS
739.IP \(em 3m
740James Clark (jjc@jclark.com) wrote the implementation of the macro package.
741.IP \(em
742Rickard E. Faith (faith@cs.unc.edu) wrote the initial version of
743this manual page.
744.IP \(em
745Jens Schweikhardt (schweikh@noc.fdn.de) wrote the Linux Man-Page Mini-HOWTO
746(which influenced this manual page).
747.IP \(em
748David A. Wheeler (dwheeler@ida.org) heavily modified this
749manual page, such as adding detailed information on sections and macros.
750.SH "SEE ALSO"
751.BR apropos (1),
752.BR groff (1),
753.BR man (1),
754.BR man2html (1),
755.BR mdoc (7),
756.BR mdoc.samples (7),
757.BR groff_www (7),
758.BR whatis (1)