Man page


A man page is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs, formal standards and conventions, and even abstract concepts. A user may invoke a man page by issuing the man command.
By default, man typically uses a terminal pager program such as more or less to display its output.
Because man pages are distributed together with the software they document, they are a more favourable means of documenting software compared to out-of-band documentation like web pages, as there is a higher likelihood for a match between the actual features of the software to the documented ones.
It is for this reason that man-pages are often referred to as an on-line or online form of software documentation, even though the man command does not require internet access, dating back to the times when printed out-of-band manuals were the norm.

History

In the first two years of the history of Unix, no documentation existed. The was first published on November 3, 1971. The first actual man pages were written by Dennis Ritchie and Ken Thompson at the insistence of their manager Doug McIlroy in 1971. Aside from the man pages, the Programmer's Manual also accumulated a set of short papers, some of them tutorials, and others more detailed descriptions of operating system features. The printed version of the manual initially fit into a single binder, but as of PWB/UNIX and the 7th Edition of Research Unix, it was split into two volumes with the printed man pages forming Volume 1.
Later versions of the documentation imitated the first man pages' terseness. Ritchie added a "How to get started" section to the Third Edition introduction, and Lorinda Cherry provided the "Purple Card" pocket reference for the Sixth and Seventh Editions. Versions of the software were named after the revision of the manual; the seventh edition of the Unix Programmer's Manual, for example, came with the 7th Edition or Version 7 of Unix.
For the Fourth Edition the man pages were formatted using the troff typesetting package and its set of -man macros. At the time, the availability of online documentation through the manual page system was regarded as a great advance. To this day, virtually every Unix command line application comes with a man page, and many Unix users perceive a program's lack of man pages as a sign of low quality; indeed, some projects, such as Debian, go out of their way to write man pages for programs lacking one. The modern descendants of 4.4BSD also distribute man pages as one of the primary forms of system documentation.
There was a hidden easter egg in the man-db version of the man command that would cause the command to return "gimme gimme gimme" when run at 00:30. It was introduced in 2011 but first restricted and then removed in 2017 after finally being found.

Formatting

The default format of the man pages is troff, with either the macro package man or mdoc. This makes it possible to typeset a man page into PostScript, PDF, and various other formats for viewing or printing.
Most Unix systems have a package for the man2html command, which enables users to browse their man pages using an HTML browser.
In 2010, OpenBSD deprecated troff for formatting manpages in favour of mandoc, a specialised compiler/formatter for manpages with native support for output in PostScript, HTML, XHTML, and the terminal. It is meant to only support of a subset of troff used in manual pages, specifically those using the mdoc macros.

Online services

Quite a few websites offer online access for manual pages from various Unix-like systems.
In February 2013, the BSD community saw a new open source service launched, which unified and shortened access to the man.cgi scripts of the major modern BSD projects through a unique nginx-based deterministic URL shortening service for the *BSD man pages.
For Linux, a man7.org service has been set up to serve manuals specific to the system. A ManKier service provides a wider selection, and integrates the TLDR pages too.

Command usage

To read a manual page for a Unix command, a user can type:

man

Pages are traditionally referred to using the notation "name": for example,. The section refers to different ways the topic might be referenced - for example, as a system call, or a shell command or package, or a package's configuration file, or as a coding construct / header.
The same page name may appear in more than one section of the manual, such as when the names of system calls, user commands, or macro packages coincide. Examples are and, or and. The syntax for accessing the non-default manual section varies between different man implementations.
On Solaris and illumos, for example, the syntax for reading is:

man -s 3c printf

On Linux and BSD derivatives the same invocation would be:

man 3 printf

which searches for printf in section 3 of the man pages.

Manual sections

The manual is generally split into eight numbered sections, organized as follows :
SectionDescription
1General commands
2System calls
3Library functions, covering in particular the C standard library
4Special files and drivers
5File formats and conventions
6Games and screensavers
7Miscellanea
8System administration commands and daemons

Unix System V uses a similar numbering scheme, except in a different order:
SectionDescription
1General commands
1MSystem administration commands and daemons
2System calls
3C library functions
4File formats and conventions
5Miscellanea
6Games and screensavers
7Special files and drivers

On some systems some of the following sections are available:
SectionDescription
0C library header files
9Kernel routines
nTcl/Tk keywords
xThe X Window System

Some sections are further subdivided by means of a suffix; for example, in some systems, section 3C is for C library calls, 3M is for the math library, and so on. A consequence of this is that section 8 is sometimes relegated to the 1M subsection of the main commands section. Some subsection suffixes have a general meaning across sections:
SubsectionDescription
pPOSIX specifications
xX Window System documentation

Some versions of man cache the formatted versions of the last several pages viewed. One form is the cat page, simply piped to the pager for display.

Layout

All man pages follow a common layout that is optimized for presentation on a simple ASCII text display, possibly without any form of highlighting or font control. Sections present may include:
; NAME: The name of the command or function, followed by a one-line description of what it does.
; SYNOPSIS: In the case of a command, a formal description of how to run it and what command line options it takes. For program functions, a list of the parameters the function takes and which header file contains its declaration.
; DESCRIPTION: A textual description of the functioning of the command or function.
; EXAMPLES: Some examples of common usage.
; SEE ALSO: A list of related commands or functions.
Other sections may be present, but these are not well standardized across man pages. Common examples include: OPTIONS, EXIT STATUS, RETURN VALUE, ENVIRONMENT, BUGS, FILES, AUTHOR, REPORTING BUGS, HISTORY and COPYRIGHT.

Authoring

Manual pages can be written either in the old macros, the new macros, or a combination of both. The macro set provides minimal rich text functions, with directives for the title line, section headers, fonts, paragraphs and adding/reducing indentation. The newer language is more semantic in nature, and contains specialized macros for most standard sections such as program name, synopsis, function names, and the name of the authors. This information can be used to implement a semantic search for manuals by programs such as mandoc. Although it also includes directives to directly control the styling, it is expected that the specialized macros will cover most of the use-cases.
Although man pages are, to troff, text laid out using 10-point Roman type, this distinction is usually moot because man pages are viewed in the terminal instead of laid out on paper. As a result, the "small font" macro is seldom used. On the other hand, bold and italic text is supported by the terminal via ECMA-48, and groff's does emit them as requested when it detects a supporting terminal. The BSD mandoc however only supports bold and underlined text via the typewriter overstrike-with-backspace sequence, which needs to be translated into ECMA-48 by.
Man pages are usually written in English, but translations into other languages may be available on the system. The GNU and the mandoc is known to search for localized manual pages under subdirectories.

Alternatives

Few alternatives to man have enjoyed much popularity, with the possible exception of GNU Project's "info" system, an early and simple hypertext system. There is also a third-party effort known as " pages" that provides simple examples for common use cases, similar to a cheatsheet.
In addition, some Unix GUI applications now provide end-user documentation in HTML and include embedded HTML viewers such as yelp for reading the help within the application.