man-pages(7)

๐Ÿฆ‹ man-pages(7) ๐Ÿฆ‹

okay so this is the Miscellaneous Information Manual page for man-pages โ€” the conventions for writing Linux man pages. Think of it as the group chat rules for making docs that actually slay. ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

man-pages โ€” conventions for writing Linux man pages.

โœจ SYNOPSIS โœจ

man [section] title

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

This page is the vibe guide for conventions you should use when writing man pages for the Linux man-pages project. That project documents the user-space API that the Linux kernel and the GNU C library hand out. So yeah, it's kind of a big deal.

Because of that, the project provides most of the pages in Section 2, many pages in Sections 3, 4, and 7, and a few pages in Sections 1, 5, and 8 of the man pages on a Linux system. The conventions here may also be useful if you're writing man pages for other projects. No gatekeeping, bestie. ๐Ÿซถ

๐Ÿ“š Sections of the manual pages ๐Ÿ“š

The manual Sections are traditionally defined like this:

  1. User commands (Programs) โ€” Commands that can be executed by the user from within a shell.
  2. System calls โ€” Functions which wrap operations performed by the kernel.
  3. Library calls โ€” All library functions excluding the system call wrappers (Most of the libc functions).
  4. Special files (devices) โ€” Files found in /dev which allow to access to devices through the kernel.
  5. File formats and configuration files โ€” Describes various human-readable file formats and configuration files.
  6. Games โ€” Games and funny little programs available on the system.
  7. Overview, conventions, and miscellaneous โ€” Overviews or descriptions of various topics, conventions, and protocols, character set standards, the standard filesystem layout, and miscellaneous other things.
  8. System management commands โ€” Commands like mount(8), many of which only root can execute.

๐Ÿงต Macro package ๐Ÿงต

New manual pages should be marked up using the groff an.tmac package described in man(7). This choice is mainly for consistency: the vast majority of existing Linux manual pages are marked up using these macros. So yeah, match the energy of the existing archive. โœจ

๐Ÿงš Conventions for source file layout ๐Ÿงš

Please limit source code line length to no more than about 75 characters wherever possible. This helps avoid line-wrapping in some mail clients when patches are submitted inline. Nobody wants their patch to look like it got chewed by a printer. ๐Ÿ˜ญ

๐ŸŽ€ Title line ๐ŸŽ€

The first command in a man page should be a TH command:

.TH title section date source manual-section

The arguments of the command are as follows:

  • title โ€” The title of the man page.
  • section โ€” The section number in which the man page should be placed (e.g., 7).
  • date โ€” The date of the last nontrivial change that was made to the man page. (Within the man-pages project, the necessary updates to these timestamps are handled automatically by scripts, so there is no need to manually update them as part of a patch.) Dates should be written in the form YYYY-MM-DD.
  • source โ€” The name and version of the project that provides the manual page (not necessarily the package that provides the functionality).
  • manual-section โ€” Normally, this should be empty, since the default value will be good.

๐Ÿ“– Sections within a manual page ๐Ÿ“–

The list below shows conventional or suggested sections. Most manual pages should include at least the highlighted sections. Arrange a new manual page so that sections are placed in the order shown in the list.

  • NAME
  • LIBRARY โ€” [Normally only in Sections 2, 3]
  • SYNOPSIS
  • CONFIGURATION โ€” [Normally only in Section 4]
  • DESCRIPTION
  • OPTIONS โ€” [Normally only in Sections 1, 8]
  • PARAMETERS
  • EXIT STATUS โ€” [Normally only in Sections 1, 8]
  • RETURN VALUE โ€” [Normally only in Sections 2, 3]
  • ERRORS โ€” [Typically only in Sections 2, 3]
  • ENVIRONMENT
  • FILES
  • ATTRIBUTES โ€” [Normally only in Sections 2, 3]
  • VERSIONS โ€” [Normally only in Sections 2, 3]
  • STANDARDS
  • HISTORY
  • NOTES
  • CAVEATS
  • BUGS
  • EXAMPLES
  • AUTHORS โ€” [Discouraged]
  • REPORTING BUGS โ€” [Not used in man-pages]
  • COPYRIGHT โ€” [Not used in man-pages]
  • SEE ALSO

Where a traditional heading would apply, please use it; this kind of consistency can make the information easier to understand. If you must, you can create your own headings if they make things easier to understand (this can be especially useful for pages in Sections 4 and 5). However, before doing this, consider whether you could use the traditional headings, with some subsections (.SS) within those sections.

The following list elaborates on the contents of each of the above sections. ๐Ÿ‘‡

NAME

The name of this manual page.

See man(7) for important details of the line(s) that should follow the .SH NAME command. All words in this line (including the word immediately following the \-) should be in lowercase, except where English or technical terminological convention dictates otherwise.

LIBRARY

The library providing a symbol.

It shows the common name of the library, and in parentheses, the name of the library file and, if needed, the linker flag needed to link a program against it: (libfoo[, -lfoo]).

SYNOPSIS

A brief summary of the command or function's interface.

For commands, this shows the syntax of the command and its arguments (including options); boldface is used for as-is text and italics are used to indicate replaceable arguments. Brackets ([]) surround optional arguments, vertical bars (|) separate choices, and ellipses (...) can be repeated. For functions, it shows any required data declarations or #include directives, followed by the function declaration.

Where a feature test macro must be defined in order to obtain the declaration of a function (or a variable) from a header file, then the SYNOPSIS should indicate this, as described in feature_test_macros(7).

CONFIGURATION

Configuration details for a device.

This section normally appears only in Section 4 pages.

DESCRIPTION

An explanation of what the program, function, or format does.

Discuss how it interacts with files and standard input, and what it produces on standard output or standard error. Omit internals and implementation details unless they're critical for understanding the interface. Describe the usual case; for information on command-line options of a program use the OPTIONS section.

When describing new behavior or new flags for a system call or library function, be careful to note the kernel or C library version that introduced the change. The preferred method of noting this information for flags is as part of a .TP list, in the following form (here, for a new system call flag):

XYZ_FLAG (since Linux 3.7)
       Description of flag...

Including version information is especially useful to users who are constrained to using older kernel or C library versions (which is typical in embedded systems, for example).

OPTIONS

A description of the command-line options accepted by a program and how they change its behavior.

This section should appear only for Section 1 and 8 manual pages.

PARAMETERS

A description of the parameters of the function or program, and how they change its behavior.

EXIT STATUS

A list of the possible exit status values of a program and the conditions that cause these values to be returned.

This section should appear only for Section 1 and 8 manual pages.

RETURN VALUE

For Section 2 and 3 pages, this section gives a list of the values the library routine will return to the caller and the conditions that cause these values to be returned.

ERRORS

For Section 2 and 3 manual pages, this is a list of the values that may be placed in errno in the event of an error, along with information about the cause of the errors.

Where several different conditions produce the same error, the preferred approach is to create separate list entries (with duplicate error names) for each of the conditions. This makes the separate conditions clear, may make the list easier to read, and allows metainformation (e.g., kernel version number where the condition first became applicable) to be more easily marked for each condition.

The error list should be in alphabetical order.

ENVIRONMENT

A list of all environment variables that affect the program or function and how they affect it.

FILES

A list of the files the program or function uses, such as configuration files, startup files, and files the program directly operates on.

Give the full pathname of these files, and use the installation process to modify the directory part to match user preferences. For many programs, the default installation location is in /usr/local, so your base manual page should use /usr/local as the base.

ATTRIBUTES

A summary of various attributes of the function(s) documented on this page. See attributes(7) for further details.

VERSIONS

A summary of systems where the API performs differently, or where there's a similar API.

STANDARDS

A description of any standards or conventions that relate to the function or command described by the manual page.

The preferred terms to use for the various standards are listed as headings in standards(7).

This section should note the current standards to which the API conforms to.

If the API is not governed by any standards but commonly exists on other systems, note them. If the call is Linux-specific or GNU-specific, note this. If it's available in the BSDs, note that.

If this section consists of just a list of standards (which it commonly does), terminate the list with a period (.).

HISTORY

A brief summary of the Linux kernel or glibc versions where a system call or library function appeared, or changed significantly in its operation.

...and okay, so real talk: as a general rule, every brand-new interface should come with a HISTORY section in its manual page. That's the goal. But ngl, a LOT of existing manual pages just... don't have this info, and honestly it's not their fault โ€” nobody was enforcing it back when they were written. ๐Ÿฅฒ Patches that fix this up? very welcome. But from the perspective of a programmer writing new code, this info probably only matters in two cases: kernel interfaces added in Linux 2.4 or later (i.e., stuff that changed since Linux 2.2), and library functions added to glibc since glibc 2.1 (i.e., changes since glibc 2.0).

Also, the syscalls(2) manual page is out here doing the absolute most ๐Ÿ‘‘ โ€” it also gives you info about the kernel versions where various system calls first appeared.

Old versions of standards should be mentioned here in HISTORY, rather than in STANDARDS โ€” like SUS, SUSv2, and XPG, or the SVr4 and 4.xBSD implementation standards. iykyk.


๐ŸŒธ NOTES ๐ŸŒธ

Miscellaneous notes. The catch-all, the junk drawer, the โœจvibesโœจ section.

For Section 2 and Section 3 man pages you may find it useful to include subsections (SS) named Linux Notes and glibc Notes.

In Section 2, use the heading C library/kernel differences to mark off notes that describe the differences (if any! sometimes there are none, and that's also a vibe) between the C library wrapper function for a system call and the raw system call interface provided by the kernel.

๐Ÿ’ฅ CAVEATS ๐Ÿ’ฅ

Warnings about typical user misuse of an API โ€” the classic ways people fumble it โ€” that don't constitute an API bug or a design defect. So like, not "this is broken," more like "bestie, please don't do that."

๐Ÿ’€ BUGS ๐Ÿ’€

A list of limitations, known defects or inconveniences, and other questionable activities. Yes, "questionable activities" is the actual wording and yes, it goes hard. ๐Ÿซถ

โœจ EXAMPLES โœจ

One or more examples demonstrating how this function, file, or command is used.

For details on writing example programs, see Example programs below.

๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

A list of authors of the documentation or program.

Use of an AUTHORS section is strongly discouraged. Generally, it is better not to clutter every page with a list of (over time potentially numerous) authors; if you write or significantly amend a page, add a copyright notice as a comment in the source file. If you are the author of a device driver and want to include an address for reporting bugs, place this under the BUGS section.

๐Ÿ› REPORTING BUGS ๐Ÿ›

The man-pages project doesn't use a REPORTING BUGS section in manual pages. Information on reporting bugs is instead supplied in the script-generated COLOPHON section. However, various projects do use a REPORTING BUGS section. It is recommended to place it near the foot of the page.

The man-pages project doesn't use a COPYRIGHT section in manual pages either. Copyright information is instead maintained in the page source. In pages where this section is present, it is recommended to place it near the foot of the page, just above SEE ALSO.

๐Ÿ”— SEE ALSO ๐Ÿ”—

A comma-separated list of related man pages, possibly followed by other related pages or documents.

The list should be ordered by section number and then alphabetically by name. Do not terminate this list with a period. (periodt, but not literally a period, bestie ๐Ÿ’…)

Where the SEE ALSO list contains many long manual page names, to improve the visual result of the output, it may be useful to employ the .ad l (don't right justify) and .nh (don't hyphenate) directives. Hyphenation of individual page names can be prevented by preceding words with the string "\%".

Given the distributed, autonomous nature of FOSS projects and their documentation, it is sometimes necessary โ€” and in many cases desirable โ€” that the SEE ALSO section includes references to manual pages provided by other projects. Cross-project love, we <3 to see it. ๐ŸŒˆ


๐ŸŒŸ FORMATTING AND WORDING CONVENTIONS ๐ŸŒŸ

The following subsections note some details for preferred formatting and wording conventions in various sections of the pages in the man-pages project.

โœจ SYNOPSIS โœจ

Wrap the function prototype(s) in a .nf/.fi pair to prevent filling.

Forward declarations of parameters in functions should not use bold nor italics; this helps distinguish them visually from actual parameters. As an example:

    int snprintf(size_t size;
                 char str[restrict size], size_t size,
                 const char *restrict format, ...);

In general, where more than one function prototype is shown in the SYNOPSIS, the prototypes should not be separated by blank lines. However, blank lines (achieved using .P) may be added in the following cases:

  • to separate long lists of function prototypes into related groups (see for example list(3));
  • in other cases that may improve readability.

In the SYNOPSIS, a long function prototype may need to be continued over to the next line. The continuation line is indented according to the following rules:

  1. If there is a single such prototype that needs to be continued, then align the continuation line so that when the page is rendered on a fixed-width font device (e.g., on an xterm) the continuation line starts just below the start of the argument list in the line above. (Exception: the indentation may be adjusted if necessary to prevent a very long continuation line or a further continuation line where the function prototype is very long.) As an example:
     int tcsetattr(int fd, int optional_actions,
                   const struct termios *termios_p);
  1. But, where multiple functions in the SYNOPSIS require continuation lines, and the function names have different lengths, then align all continuation lines to start in the same column. This provides a nicer rendering in PDF output (because the SYNOPSIS uses a variable width font where spaces render narrower than most characters). As an example:
     int getopt(int argc, char * const argv[],
                const char *optstring);
     int getopt_long(int argc, char * const argv[],
                const char *optstring,
                const struct option *longopts, int *longindex);

๐Ÿซถ RETURN VALUE ๐Ÿซถ

The preferred wording to describe how errno is set is "errno is set to indicate the error" or similar. This wording is consistent with the wording used in both POSIX.1 and FreeBSD. Consistency slay. โœจ

๐ŸŒˆ ATTRIBUTES ๐ŸŒˆ

Note the following:

  • Wrap the table in this section in a .ad l/.ad pair to disable text filling and a .nh/.hy pair to disable hyphenation.
  • Ensure that the table occupies the full page width through the use of an lbx description for one of the columns (usually the first column, though in some cases the last column if it contains a lot of text).
  • Make free use of T{/T} macro pairs to allow table cells to be broken over multiple lines (also bearing in mind that pages may sometimes be rendered to a width of less than 80 columns).

For examples of all of the above, see the source code of various pages.


๐Ÿ’œ STYLE GUIDE ๐Ÿ’œ

The following subsections describe the preferred style for the man-pages project. For details not covered below, the Chicago Manual of Style is usually a good source; try also grepping for preexisting usage in the project source tree.

UNIX for Beginners [2nd ed., Brian W. Kernighan] also contains a noteworthy section, โ€œHints for Preparing Documentsโ€.

๐Ÿงš Use of gender-neutral language ๐Ÿงš

As far as possible, use gender-neutral language in the text of man pages. Use of "they" ("them", "themself", "their") as a gender-neutral singular pronoun is acceptable. (correct and iconic, no notes ๐Ÿ’–)

โŒจ๏ธ Formatting conventions for manual pages describing commands โŒจ๏ธ

For manual pages that describe a command (typically in Sections 1 and 8), the arguments are always specified using italics, even in the SYNOPSIS section.

The name of the command, and its options, should always be formatted in bold.

๐Ÿงฎ Formatting conventions for manual pages describing functions ๐Ÿงฎ

For manual pages that describe functions (typically in Sections 2 and 3), the arguments are always specified using italics, even in the SYNOPSIS section, where the rest of the function is specified in bold:

    int myfunction(int argc, char **argv);

Variable names should, like argument names, be specified in italics.

Any reference to the subject of the current manual page should be written with the name in bold followed by a pair of parentheses in Roman (normal) font. For example, in the fcntl(2) man page, references to the subject of the page would be written as: fcntl(). The preferred way to write this in the source file is:

    .BR fcntl ()

(Using this format, rather than the use of "\fB...\fP()" makes it easier to write tools that parse man page source files.)

๐ŸŒธ Use semantic newlines ๐ŸŒธ

In the source of a manual page, new sentences should be started on new lines, long sentences should be split into lines at clause breaks (commas, semicolons, colons, and so on), and long clauses should be split at phrase boundaries. This convention, sometimes known as "semantic newlines", makes it easier to see the effect of patches, which often operate at the level of individual sentences, clauses, or phrases. One clause per line, bestie, your diff reviews will thank you. ๐Ÿ™ˆ

๐Ÿ“ Lists ๐Ÿ“

There are different kinds of lists:

Tagged paragraphs

These are used for a list of tags and their descriptions. When the tags are constants (either macros or numbers) they are in bold. Use the .TP macro.

An example is this "Tagged paragraphs" subsection is itself.

Ordered lists

Elements are preceded by a number in parentheses (1), (2). These represent a set of steps that have an order.

When there are substeps, they will be numbered like (4.2).

Positional lists

Elements are preceded by a number (index) in square brackets [4], [5]. These represent fields in a set. The first index will be:

  • 0 โ€” When it represents fields of a C data structure, to be consistent with arrays.
  • 1 โ€” When it represents fields of a file, to be consistent with tools like cut(1).

Alternatives list

Elements are preceded by a letter in parentheses (a), (b). These represent a set of (normally) exclusive alternatives.

Bullet lists

Elements are preceded by bullet symbols (\[bu\]). Anything that doesn't fit elsewhere is usually covered by this type of list.

Numbered notes

Not really a list, but the syntax is identical to "positional lists".

There should always be exactly 2 spaces between the list symbol and the elements. This doesn't apply to "tagged paragraphs", which use the default indentation rules.

Formatting conventions (general) ๐Ÿ’–

Okay bestie, para breaks: separate your paragraphs with actual markers โ€” usually .P or .IP โ€” and do not use blank lines, because that renders like trash in some output formats (looking at you, PostScript and PDF ๐Ÿ˜ญ).

Filenames โ€” whether they're pathnames or references to header files โ€” are always in italics (like &lt;stdio.h&gt;), except in the SYNOPSIS section, where included files go bold (like #include <stdio.h>). And when you're referring to a standard header file include, write that header surrounded by angle brackets, the normal C way (like &lt;stdio.h&gt;).

Special macros, which are usually in uppercase, get bolded (like MAXINT). โœจ Exception though: don't boldface NULL. Periodt.

When you're enumerating a list of error codes, those codes are bold โ€” and that list usually uses the .TP macro.

Complete commands: if it's long, put it on its own indented line with a blank line before and after, like this:

man 7 man-pages

If the command is short though, you can inline it in the text in italic format, like man 7 man-pages. In that case it may be worth using nonbreaking spaces (\~) at suitable spots in the command. Command options get italics too (like -l).

Expressions: if you're not putting them on their own separate indented line, write them in italics. And again, nonbreaking spaces can be the move if the expression is inlined into normal text.

Example shell sessions: user input goes in bold, like so:

$ date;
Thu Jul  7 13:01:27 CEST 2016

Any reference to another man page: the name goes in bold, always followed by the section number in Roman (normal) font, no separating spaces (like intro(2)). The preferred way to write this in the source file is:

.BR intro (2)

(Including that section number in cross references is what lets tools like man2html(1) build properly hyperlinked pages. Iconic behavior honestly. ๐Ÿ‘‘)

Control characters: write them in bold, no quotes โ€” for example ^X.


Spelling ๐Ÿ”ค

Starting with release 2.59, man-pages follows American spelling conventions (before that it was a random mix of British and American spellings โ€” chaos ๐Ÿ˜ญ). So please write all new pages and patches according to these conventions, bestie.

Aside from the well-known spelling differences, there are a few other subtleties to watch for:

  • American English tends to use the forms "backward", "upward", "toward", and so on rather than the British forms "backwards", "upwards", "towards", and so on.
  • Opinions are divided on "acknowledgement" vs "acknowledgment". The latter is predominant, but not universal usage in American English. POSIX and the BSD license use the former spelling. In the Linux man-pages project, we use "acknowledgement".

BSD version numbers ๐Ÿ”ข

The classical scheme for writing BSD version numbers is x.yBSD, where x.y is the version number (e.g., 4.2BSD). And avoid forms like BSD 4.3 โ€” just don't. ๐Ÿ’€


Capitalization ๐Ÿ” 

In subsection ("SS") headings, capitalize the first word in the heading, but otherwise use lowercase โ€” except where English usage (proper nouns, bestie) or programming language requirements (identifier names) say otherwise. For example:

.SS Unicode under Linux

Indentation of structure definitions, shell session logs, and so on ๐Ÿ“

When structure definitions, shell session logs, and so on get included in running text, you:

  • indent them by 4 spaces (i.e., a block enclosed by .in +4n and .in),
  • format them using the .EX and .EE macros,
  • and surround them with suitable paragraph markers (either .P or .IP).

For example:

.P
.in +4n
.EX
int
main(int argc, char *argv[])
{
    return 0;
}
.EE
.in
.P

Preferred terms ๐Ÿ’…

The following list is basically a vibe-check cheat sheet of some preferred terms to use in man pages, mainly to keep everything consistent across pages. (Original called it a table โ€” same energy, cuter layout. ๐ŸŽ€)

  • bit mask โ€” avoid bitmask
  • built-in โ€” avoid builtin
  • Epoch โ€” avoid epoch โ€” note: for the UNIX Epoch (00:00:00, 1 Jan 1970 UTC)
  • filename โ€” avoid file name
  • filesystem โ€” avoid file system
  • hostname โ€” avoid host name
  • inode โ€” avoid i-node
  • lowercase โ€” avoid lower case, lower-case
  • nonzero โ€” avoid non-zero
  • pathname โ€” avoid path name
  • pseudoterminal โ€” avoid pseudo-terminal
  • privileged port โ€” avoid reserved port, system port
  • real-time โ€” avoid realtime, real time
  • run time โ€” avoid runtime
  • saved set-group-ID โ€” avoid saved group ID, saved set-GID
  • saved set-user-ID โ€” avoid saved user ID, saved set-UID
  • set-group-ID โ€” avoid set-GID, setgid
  • set-user-ID โ€” avoid set-UID, setuid
  • superuser โ€” avoid super user, super-user
  • superblock โ€” avoid super block, super-block
  • symbolic link โ€” avoid symlink
  • timestamp โ€” avoid time stamp
  • timezone โ€” avoid time zone
  • uppercase โ€” avoid upper case, upper-case
  • usable โ€” avoid useable
  • user space โ€” avoid userspace
  • username โ€” avoid user name
  • x86-64 โ€” avoid x86_64 โ€” note: except if you're referring to the result of uname -m or something similar
  • zeros โ€” avoid zeroes

See also the discussion Hyphenation of attributive compounds below. ๐Ÿ‘‡


Terms to avoid ๐Ÿšซ

And here's the other list: terms to avoid using in man pages, plus some suggested alternatives โ€” again, mainly so everything stays consistent across pages.

  • avoid 32bit โ†’ use 32-bit โ€” same for 8-bit, 16-bit, etc.
  • avoid current process โ†’ use calling process โ€” note: a common mistake made by kernel programmers when writing man pages ๐Ÿ˜ญ
  • avoid manpage โ†’ use man page, manual page
  • avoid minus infinity โ†’ use negative infinity
  • avoid non-root โ†’ use unprivileged user
  • avoid non-superuser โ†’ use unprivileged user
  • avoid nonprivileged โ†’ use unprivileged
  • avoid OS โ†’ use operating system
  • avoid plus infinity โ†’ use positive infinity
  • avoid pty โ†’ use pseudoterminal
  • avoid tty โ†’ use terminal
  • avoid Unices โ†’ use UNIX systems
  • avoid Unixes โ†’ use UNIX systems

Trademarks โ„ข๏ธ

Use the correct spelling and case for trademarks. Here's the list of correct spellings of various relevant trademarks that get misspelled sometimes:

  • DG/UX
  • HP-UX
  • UNIX
  • UnixWare

NULL, NUL, null pointer, and null byte ๐ŸŒซ๏ธ

A null pointer is a pointer that points to nothing, and it's normally indicated by the constant NULL. On the other hand, NUL is the null byte โ€” a byte with the value 0, represented in C via the character constant '\0'.

The preferred term for the pointer is "null pointer" or simply "NULL"; avoid writing "NULL pointer".

The preferred term for the byte is "null byte". Avoid writing "NUL", since it's too easily confused with "NULL". Also avoid the terms "zero byte" and "null character". The byte that terminates a C string should be described as "the terminating null byte"; strings may be described as "null-terminated", but avoid the use of "NUL-terminated".


For hyperlinks, use the .UR/.UE macro pair (see groff_man(7)). This produces proper hyperlinks that actually work in a web browser when you render a page with, say:

BROWSER=firefox man -H pagename

So cute, so functional. ๐Ÿฆ‹


Use of e.g., i.e., etc., a.k.a., and similar ๐Ÿ™ˆ

In general, avoid abbreviations like "e.g.", "i.e.", "etc.", "cf.", and "a.k.a." in favor of suitable full wordings ("for example", "that is", "and so on", "compare to", "also known as").

The only place where such abbreviations may be acceptable is in short parenthetical asides (e.g., like this one).

Always include periods in such abbreviations, as shown here. In addition, "e.g." and "i.e." should always be followed by a comma.


Em-dashes โ€”

The way to write an em-dash โ€” the glyph that appears at either end of this subphrase โ€” in *roff is with the macro "\[em]". (On an ASCII terminal, an em-dash typically renders as two hyphens, but in other typographical contexts it renders as a long dash.) Em-dashes should be written without surrounding spaces. ๐Ÿ’–


Hyphenation of attributive compounds โœ‚๏ธ

Compound terms should be hyphenated when used attributively (i.e., to qualify a following noun). Some examples:

  • 32-bit value
  • command-line argument
  • floating-point number
  • run-time check
  • user-space function
  • wide-character string

Hyphenation with multi, non, pre, re, sub, and so on ๐Ÿงš

The general tendency in modern English is not to hyphenate after prefixes such as "multi", "non", "pre", "re", "sub", and so on. Manual pages should generally follow this rule when these prefixes show up in natural English constructions with simple suffixes. Here's the preferred-forms list:

  • interprocess
  • multithreaded
  • multiprocess
  • nonblocking
  • nondefault
  • nonempty
  • noninteractive
  • nonnegative
  • nonportable
  • nonzero
  • preallocated
  • precreate
  • prerecorded
  • reestablished
  • reinitialize
  • rearm
  • reread
  • subcomponent
  • subdirectory
  • subsystem

Hyphens should be retained when the prefixes are used in nonstandard English words, with trademarks, proper nouns, acronyms, or compound terms. Some examples:

  • non-ASCII
  • non-English
  • non-NULL
  • non-real-time

Finally, note that "re-create" and "recreate" are two different verbs, and the former is probably what you want. ๐Ÿ˜Œ


Generating optimal glyphs โญ

Where a real minus character is required (e.g., for numbers such as -1, for man page cross references such as utf-8(7), or when writing options that have a leading dash, such as in ls -l), use the following form in the man page source:

Okay so about that \- thing โ€” this guideline applies also to code examples, not just prose, bestie. ๐Ÿ’…

The use of real minus signs serves the following purposes:

  • So it actually looks good on targets that aren't ASCII terminals โ€” notably in PDF and on Unicode/UTF-8-capable terminals. โœจ
  • So the glyphs you get are the kind that, when you copy them off a rendered page and paste them into a terminal, land as real minus signs. No weird impostor hyphen energy. ๐Ÿ™…โ€โ™€๏ธ

Now, for unslanted single quotes that render well in ASCII, UTF-8, and PDF, you want \[aq] ("apostrophe quote"), like:

\[aq]C\[aq]

where C is the quoted character. And yep โ€” this guideline applies also to character constants used in code examples. ๐ŸŽ€

Where you need a proper caret (^) that renders well in both a terminal and PDF, use \[ha]. This is especially necessary in code samples, so you get a nicely rendered caret when rendering to PDF. Lowkey non-negotiable there. ๐Ÿ˜Œ

And a naked ~? It renders poorly in PDF. Use \[ti] instead โ€” again especially necessary in code samples, so your tilde renders nicely when it hits PDF. ๐ŸŒธ


๐ŸŒˆ Example programs and shell sessions ๐ŸŒˆ

Manual pages may include example programs demonstrating how to use a system call or library function. However, note the following:

  • Example programs should be written in C. No cap. ๐Ÿ’ฏ
  • An example program is necessary and useful only if it demonstrates something beyond what can easily be provided in a textual description of the interface. An example program that does nothing other than call an interface usually serves little purpose โ€” that's just filler, and we don't stan filler. ๐Ÿ™ˆ
  • Example programs should ideally be short (e.g., a good example can often be provided in less than 100 lines of code), though in some cases longer programs may be necessary to properly illustrate the use of an API.
  • Expressive code is appreciated. ๐Ÿ‘‘
  • Comments should be included where helpful. Complete sentences in free-standing comments should be terminated by a period. Periods should generally be omitted in "tag" comments (i.e., comments that are placed on the same line of code); such comments are in any case typically brief phrases rather than complete sentences.
  • Example programs should do error checking after system calls and library function calls. Check your errors, bestie, the kernel is not gonna do it for you.
  • Example programs should be complete, and compile without warnings when compiled with cc -Wall. Warnings are not a vibe.
  • Where possible and appropriate, example programs should allow experimentation, by varying their behavior based on inputs (ideally from command-line arguments, or alternatively, via input read by the program).
  • Example programs should be laid out according to Kernighan and Ritchie style, with 4-space indents. (Avoid the use of TAB characters in source code!) The following command can be used to format your source code to something close to the preferred style:
indent -npro -kr -i4 -ts4 -sob -l72 -ss -nut -psl prog.c
  • For consistency, all example programs should terminate using either of:
exit(EXIT_SUCCESS);
exit(EXIT_FAILURE);

Avoid using the following forms to terminate a program:

exit(0);
exit(1);
return n;
  • If there is extensive explanatory text before the program source code, mark off the source code with a subsection heading Program source, as in:
.SS Program source

Always do this if the explanatory text includes a shell session log.

If you include a shell session log demonstrating the use of a program or other system feature:

  • Place the session log above the source code listing. โฌ†๏ธ
  • Indent the session log by four spaces.
  • Boldface the user input text, to distinguish it from output produced by the system.

For some examples of what example programs should look like, see wait(2) and pipe(2). Go look at them, they're the moment. ๐Ÿซถ


โœจ EXAMPLES โœจ

For canonical examples of how man pages in the man-pages package should look, see pipe(2) and fcntl(2). Those two are the blueprint, fr fr. ๐Ÿฆ‹


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

man(1), man2html(1), attributes(7), groff(7), groff_man(7), man(7), mdoc(7)


And that's a wrap on the whole page, bestie!! ๐ŸŽ‰ You just read through Linux man-pages 6.20, dated 2026-02-08 โ€” so go forth, write your manual pages with proper minus signs, EXIT_SUCCESS, and immaculate 4-space indents. Slay responsibly. ๐Ÿ’–๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: Linux-man-pages-copyleft
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms