:man| Alphabetical   Categories   About us 
MAN (7) | Miscellanea | Unix Manual Pages | :man


man - macros to format man pages




groff -Tascii -man file ...

groff -Tps -man file ...

man [section] title


This manual page explains the "groff tmac.an" macro package (often called the man macro package) and related conventions for creating manual (man) pages. This macro package should be used by developers when writing or porting man pages for Linux. It is fairly compatible with other versions of this macro package, so porting man pages should not be a major problem (exceptions include the NET-2 BSD release, which uses a totally different macro package called mdoc; see mdoc(7)).

Note that NET-2 BSD mdoc man pages can be used with groff simply by specifying the -mdoc option instead of the -man option. Using the -mandoc option is, however, recommended, since this will automatically detect which macro package is in use.


The first command in a man page (after comment lines) should be

.TH "title section date source manual",


title The title of the man page (e.g., MAN).
section The section number the man page should be placed in (e.g., 7).
date The date of the last revision—remember to change this every time a change is made to the man page, since this is the most general way of doing version control.
source The source of the command.

For binaries, use something like: GNU", "NET-2", ""SLS Distribution"", ""MCC Distribution".

For system calls, use the version of the kernel that you are currently looking at: "Linux 0.99.11".

For library calls, use the source of the function: GNU", ""BSD 4.3"", ""Linux DLL 4.4.1".

manual The title of the manual (e.g., "Linux Programmer’s Manual").

Note that BSD mdoc-formatted pages begin with the Dd command, not the TH command.

The manual sections are traditionally defined as follows:

1 Commands Those commands that can be executed by the user from within a shell.
2 System calls
Those functions which must be performed by the kernel.
3 Library calls
Most of the libc functions, such as qsort(3))
4 Special files
Files found in /dev)
5 File formats and conventions
The format for /etc/passwd and other human-readable files.
6 Games
7 Macro packages and conventions
A description of the standard file system layout, network protocols, ASCII and other character codes, this man page, and other things.
8 System management commands
Commands like mount(8), many of which only root can execute.
9 Kernel routines
This is an obsolete manual section. Once it was thought a good idea to document the Linux kernel here, but in fact very little has been documented, and the documentation that exists is outdated already. There are better sources of information for kernel developers.


Sections are started with .SH followed by the heading name. If the name contains spaces and appears on the same line as .SH, then place the heading in double quotes. Traditional or suggested headings include: NAME, SYNOPSIS, DESCRIPTION, RETURN VALUE, EXIT STATUS, ERROR HANDLING, ERRORS, OPTIONS, USAGE, EXAMPLES, FILES, ENVIRONMENT, DIAGNOSTICS, SECURITY, CONFORMING TO, NOTES, BUGS, AUTHOR, and SEE ALSO. Where a traditional heading would apply, please use it; this kind of consistency can make the information easier to understand. However, feel free to create your own headings if they make things easier to understand. The only required heading is NAME, which should be the first section and be followed on the next line by a one line description of the program:

Share this page

     Follow us

Facebook Twitter Google+ LinkedIn

Created by Blin Media, 2008-2013