man page

{{short description|Unix software documentation}}

{{distinguish|Main Page}}

{{lowercase title}}

File:Sed stream editor (cropped).jpgs.]]

A man page (short for manual page) is a form of software documentation found on Unix and Unix-like operating systems. Topics covered include programs, system libraries, system calls, and sometimes local system details. The local host administrators can create and install manual pages associated with the specific host. A manual end user may invoke a documentation page by issuing the man command followed by the name of the item for which they want the documentation. These manual pages are typically requested by end users, programmers and administrators doing real time work but can also be formatted for printing.

By default, man typically uses a formatting program such as nroff with a macro package or mandoc, and also a terminal pager program such as more or less to display its output on the user's screen.

Man pages are often referred to as an online form of software documentation,{{Cite web |title=man(1) |url=https://man.freebsd.org/cgi/man.cgi?query=man&sektion=1 |access-date=2023-07-15 |website=FreeBSD General Commands Manual |archive-date=2023-01-30 |archive-url=https://web.archive.org/web/20230130060434/https://man.freebsd.org/cgi/man.cgi?query=man&sektion=1 |url-status=live }} even though the man command does not require internet access. The environment variable MANPATH often specifies a list of directory paths to search for the various documentation pages. Manual pages date back to the times when printed documentation was the norm.

History

File:Screenshot of "Xman" program.png application for viewing manual pages]]

File:OpenBSD Manpages Section 8 Intro.png section 8 intro man page, displaying in a text console]]

Before Unix (e.g., GCOS), documentation was printed pages, available on the premises to users (staff, students...), organized into steel binders, locked together in one monolithic steel reading rack, bolted to a table or counter, with pages organized for modular information updates, replacement, errata, and addenda. {{cn|date=January 2024}}

In the first two years of the history of Unix, no documentation existed.{{cite tech report |first1=M. D. |last1=McIlroy |author-link1=Doug McIlroy |year=1987 |url=http://www.cs.dartmouth.edu/~doug/reader.pdf |title=A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986 |series=CSTR |number=139 |institution=Bell Labs |access-date=2015-02-01 |archive-date=2017-11-11 |archive-url=https://web.archive.org/web/20171111151817/http://www.cs.dartmouth.edu/~doug/reader.pdf |url-status=live }} The [http://man.cat-v.org/unix-1st/ Unix Programmer's Manual] was first published on November 3, 1971. The first actual man pages were written by Dennis Ritchie and Ken Thompson at the insistence{{fact|date=February 2020}} 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 (e.g. for general Unix usage, the C programming language, and tools such as Yacc), 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.{{cite web |url=http://www.collyer.net/who/geoff/history.html |title=UNIX Evolution: 1975-1984 Part I - Diversity |last1=Darwin |first1=Ian |last2=Collyer |first2=Geoffrey |access-date=22 December 2012 |archive-date=17 July 2012 |archive-url=https://web.archive.org/web/20120717002523/http://www.collyer.net/who/geoff/history.html |url-status=live }} Originally published in Microsystems 5(11), November 1984.

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.{{r|reader}} 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.{{cite news | url=https://archive.org/stream/byte-magazine-1983-10/1983_10_BYTE_08-10_UNIX#page/n133/mode/2up | title=The Unix Tutorial / Part 3: Unix in the Microcomputer Marketplace | work=BYTE | date=October 1983 | access-date=30 January 2015 | author=Fiedler, Ryan | pages=132}}

For the Fourth Edition the man pages were formatted using the troff typesetting package{{r|reader}} and its set of -man macros (which were completely revised between the Sixth and Seventh Editions of the Manual, but have since not drastically changed). 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 or incompleteness. 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 (having replaced the old -man macros with the newer -mdoc).

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 (a reference to the ABBA song Gimme! Gimme! Gimme! (A Man After Midnight). It was introduced in 2011{{cite web|url=https://git.savannah.nongnu.org/cgit/man-db.git/commit/src/man.c?id=002a6339b1fe8f83f4808022a17e1aa379756d99|title=GIT commit 002a6339b1fe8f83f4808022a17e1aa379756d99|access-date=22 November 2017|archive-date=4 December 2017|archive-url=https://web.archive.org/web/20171204003014/http://git.savannah.nongnu.org/cgit/man-db.git/commit/src/man.c?id=002a6339b1fe8f83f4808022a17e1aa379756d99|url-status=live}} but first restricted{{cite web|url=https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=84bde8d8a9a357bd372793d25746ac6b49480525|title=GIT commit 84bde8d8a9a357bd372793d25746ac6b49480525|access-date=22 November 2017|archive-date=5 September 2018|archive-url=https://web.archive.org/web/20180905095817/https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=84bde8d8a9a357bd372793d25746ac6b49480525|url-status=live}} and then removed in 2017{{cite web|url=https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=b225d9e76fbb0a6a4539c0992fba88c83f0bd37e|title=GIT commit b225d9e76fbb0a6a4539c0992fba88c83f0bd37e|access-date=25 September 2018|archive-date=9 November 2020|archive-url=https://web.archive.org/web/20201109034103/https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=b225d9e76fbb0a6a4539c0992fba88c83f0bd37e|url-status=live}} after finally being found.{{cite web|url=https://unix.stackexchange.com/questions/405783/why-does-man-print-gimme-gimme-gimme-at-0030|title="Why does man print "gimme gimme gimme" at 00:30?"|access-date=22 November 2017|archive-date=21 November 2017|archive-url=https://web.archive.org/web/20171121230223/https://unix.stackexchange.com/questions/405783/why-does-man-print-gimme-gimme-gimme-at-0030|url-status=live}}

Formatting

File:FreeBSD typeset man page.png {{tt|man(1)}} manual page, typeset into PDF format]]

The default format of man pages is troff, with either the macro package man (appearance oriented) or mdoc (semantic oriented). This makes it possible to typeset a man page into PostScript, PDF, and various other formats for viewing or printing.

Some Unix systems have a package for the {{tt|man2html}} command, which enables users to browse their man pages using an HTML browser. Systems with groff and man-db should use the higher-quality native HTML output ({{tt|man --html}}) instead.

The GNU Emacs program WoMan (from "WithOut man") allows to browse man pages from the editor.{{cite web |last1=Wright |first1=Francis J. |title=WoMan: Browse Unix Manual Pages "W.O. (without) Man" |url=https://www.gnu.org/software/emacs/manual/html_mono/woman.html |publisher=GNU |access-date=3 August 2020 |archive-date=11 November 2020 |archive-url=https://web.archive.org/web/20201111204938/https://www.gnu.org/software/emacs/manual/html_mono/woman.html |url-status=live }}

In 2010, OpenBSD deprecated troff for formatting man pages in favour of mandoc, a specialised compiler/formatter for man pages with native support for output in PostScript, HTML, XHTML, and the terminal. It is meant to only support a subset of troff used in manual pages, specifically those using mdoc macros.

= Online services =

Quite a few websites offer online access to manual pages from various Unix-like systems.

In February 2013, the BSD community saw a new open source [http://mdoc.su/ mdoc.su] 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.{{cite web |url=http://www.freebsd.org/news/status/report-2013-01-2013-03.html#mdoc.su-%E2%80%94-Short-Manual-Page-URLs |title=FreeBSD Quarterly Status Report, January-March 2013 |publisher=FreeBSD |editor-first=Gabor |editor-last=Pali |date=12 May 2013 |access-date=25 December 2014 |archive-date=22 December 2014 |archive-url=https://web.archive.org/web/20141222022258/http://www.freebsd.org/news/status/report-2013-01-2013-03.html#mdoc.su-%E2%80%94-Short-Manual-Page-URLs |url-status=live }}{{cite mailing list |date=19 February 2013 |url=http://lists.freebsd.org/pipermail/freebsd-doc/2013-February/021465.html |mailing-list=freebsd-doc@freebsd.org |title=announcing mdoc.su, short manual page URLs |first=Constantine A. |last=Murenin |access-date=25 December 2014 |archive-date=7 August 2014 |archive-url=https://web.archive.org/web/20140807051219/http://lists.freebsd.org/pipermail/freebsd-doc/2013-February/021465.html |url-status=live }}{{cite web |url=http://mdoc.su/ |title=mdoc.su — Short manual page URLs for FreeBSD, OpenBSD, NetBSD and DragonFly BSD |first=Constantine A. |last=Murenin |date=23 February 2013 |access-date=25 December 2014 |archive-date=17 December 2014 |archive-url=https://web.archive.org/web/20141217170726/http://mdoc.su/ |url-status=live }}

For Linux, a man7.org service has been set up to serve manuals specific to the system.{{cite web |title=Linux man pages online |url=http://man7.org/linux/man-pages/index.html |website=man7.org |access-date=2020-05-05 |archive-date=2020-05-07 |archive-url=https://web.archive.org/web/20200507122101/http://www.man7.org/linux/man-pages/index.html |url-status=live }} A ManKier service provides a wider selection, and integrates the TLDR pages too.{{cite web |title=About |url=https://www.mankier.com/about |website=ManKier |access-date=2020-05-05 |archive-date=2020-04-25 |archive-url=https://web.archive.org/web/20200425112006/https://www.mankier.com/about |url-status=live }}

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(section)": for example, {{man|1|ftp|FreeBSD||inline}}. The section refers to different ways the topic might be referenced - for example, as a system call, or a shell (command line) 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 {{man|1|man|ManKier||inline}} and {{man|7|man|ManKier||inline}}, or {{man|2|exit|Linux||inline}} and {{man|3|exit|Linux||inline}}. The syntax for accessing the non-default manual section varies between different man implementations.

On Solaris and illumos, for example, the syntax for reading {{man|3c|printf|Solaris||inline}} 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. The actual file name likely includes the section. Continuing this example, printf.3.gz would be a compressed manual page file in section 3 for printf.

Manual sections

The manual is generally split into eight numbered sections. Most systems today (e.g. BSD,{{man|1|man|FreeBSD}} macOS, Linux, and Solaris 11.4) inherit the numbering scheme used by Research Unix.{{cite web |title=Manual Pages for Research Unix Eighth Edition |url=http://man.cat-v.org/unix_8th/ |website=man.cat-v.org |access-date=2020-05-06 |archive-date=2020-06-30 |archive-url=https://web.archive.org/web/20200630215702/http://man.cat-v.org/unix_8th/ |url-status=live }}{{cite web |title=Unix Programmer's Manual - Introduction |url=https://www.bell-labs.com/usr/dmr/www/manintro.html |website=www.bell-labs.com |date=November 3, 1971 |access-date=May 6, 2020 |archive-date=June 1, 2020 |archive-url=https://web.archive.org/web/20200601064923/https://www.bell-labs.com/usr/dmr/www/manintro.html |url-status=live }} While System V uses a different order:{{cite web |title=System V release 4 manuals |url=http://bitsavers.trailing-edge.com/pdf/att/unix/System_V_Release_4/ |website=bitsavers.trailing-edge.com |access-date=2020-05-06 |archive-date=2020-08-03 |archive-url=https://web.archive.org/web/20200803205815/http://bitsavers.trailing-edge.com/pdf/att/unix/System_V_Release_4/ |url-status=live }}

class="wikitable"

! Common

! System V

! Description

1

| 1

| General commands

2

| 2

| System calls

3

| 3

|Library functions, covering in particular the C standard library

4

| 7

| Special files (usually devices, those found in /dev) and drivers

5

| 4

| File formats and conventions

6

| 6

| Games and screensavers

7

| 5

| Miscellaneous

8

| 1M

| System administration commands and daemons

POSIX APIs are present in both sections 2 and 3, where section 2 contains APIs that are implemented as system calls and section 3 contains APIs that are implemented as library routines.

On some systems, additional sections may be included such as:

class="wikitable"

! Section

! Description

0

| C library header files (Unix v6)

9

| Kernel routines (FreeBSD, SVR4, Linux)

l

| LAPACK library functions{{Cite web|title=lapack (l) - Linux Man Pages|url=https://www.systutorials.com/docs/linux/man/l-lapack/|access-date=2021-05-29|website=www.systutorials.com|archive-date=2023-03-11|archive-url=https://web.archive.org/web/20230311130845/https://www.systutorials.com/docs/linux/man/l-lapack/|url-status=live}}

n

| Tcl/Tk commands

x

| The 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 (system administration commands) is sometimes relegated to the 1M subsection of the main commands section. Some subsection suffixes have a general meaning across sections:

class="wikitable"

! Subsection

! Description

pPOSIX specifications
xX Window System documentation

(Section 3 tends to be the exception with the many suffixes for different languages.)

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:{{rp|at=MANUAL STRUCTURE}}

; 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. For programs, this section often includes explanations of available command line options.

; 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 {{code|man}} macros or the new {{code|doc}} macros.{{man|5|groff_tmac|ManKier}} The {{code|man}} macro set provides minimal rich text functions, with directives for the title line, section headers, (bold, small or italic) fonts, paragraphs and adding/reducing indentation.{{man|7|man|ManKier}} The newer {{code|mdoc}} 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.{{man|7|mdoc|FreeBSD}} Both the mandoc and the groff projects consider {{code|mdoc}} the preferred format for new documents.{{cite web |title=Groff Mission Statement - 2014 |url=https://www.gnu.org/software/groff/groff-mission-statement.html |website=www.gnu.org |quote=Concurrent with work on man(7), mdoc(7) will be actively supported and its use promoted. |access-date=2021-01-02 |archive-date=2020-12-03 |archive-url=https://web.archive.org/web/20201203121306/https://www.gnu.org/software/groff/groff-mission-statement.html |url-status=live }}

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 (TTY) instead of laid out on paper. As a result, the "small font" macro is seldom used.{{cite web |title=man |url=https://www.gnu.org/software/groff/manual/html_node/man.html |website=The GNU Troff Manual |access-date=31 December 2019 |archive-date=24 December 2019 |archive-url=https://web.archive.org/web/20191224124039/https://www.gnu.org/software/groff/manual/html_node/man.html |url-status=live }} On the other hand, bold and italic text is supported by the terminal via ECMA-48, and groff's {{code|grotty}} does emit them as requested when it detects a supporting terminal. The BSD mandoc however only supports bold and underlined (as a replacement for italics) text via the typewriter backspace-then-overstrike sequence, which needs to be translated into ECMA-48 by {{code|less}}.{{cite web |title=Italics and colour in manual pages on a nosh user-space virtual terminal |url=https://jdebp.uk/Softwares/nosh/italics-in-manuals.html |website=jdebp.eu |access-date=2021-01-21 |archive-date=2021-01-28 |archive-url=https://web.archive.org/web/20210128033617/https://jdebp.uk/Softwares/nosh/italics-in-manuals.html |url-status=live }}{{man|1|mandoc|FreeBSD}}. "Font styles are applied by using back-spaced encoding..."

Some tools have been used to convert documents in a less contrived format to manual pages. Examples include GNU's {{code|help2man}}, which takes a {{code|--help}} output and some additional content to generate a manual page.{{cite web |title=help2man Reference Manual |url=https://www.gnu.org/software/help2man |access-date=5 March 2023 |archive-date=6 March 2023 |archive-url=https://web.archive.org/web/20230306093151/https://www.gnu.org/software/help2man/ |url-status=live }} The manual would be barely more useful than the said output, but for GNU programs this is not an issue as texinfo is the main documentation system.{{cite web |title=Man Pages (GNU Coding Standards) |url=https://www.gnu.org/prep/standards/html_node/Man-Pages.html |website=www.gnu.org |access-date=2023-03-05 |archive-date=2023-03-05 |archive-url=https://web.archive.org/web/20230305170922/https://www.gnu.org/prep/standards/html_node/Man-Pages.html |url-status=live }} A number of tools, including pandoc, ronn, and md2man support conversion from Markdown to manual pages. All these tools emit the {{code|man}} format, as Markdown is not expressive enough to match the semantic content of {{code|mdoc}}. DocBook has an inbuilt man(7) converter – of appalling quality, according to mandoc's author{{cite web |author=Ingo Schwarze |title=New mandoc -mdoc -T markdown converter |url=https://undeadly.org/cgi?action=article&sid=20170304230520 |website=undeadly.org |access-date=2023-03-05 |archive-date=2023-03-05 |archive-url=https://web.archive.org/web/20230305170920/https://undeadly.org/cgi?action=article&sid=20170304230520 |url-status=live }} – for specific complaints by the author, see {{cite mailing list |url=https://lists.gnu.org/archive/html/groff/2014-02/msg00109.html |title=Re: Groff man pages (tangential to Future Redux) |author=Ingo Schwarze |date=28 February 2014 |mailing-list=Groff |archive-url=https://web.archive.org/web/20230305171936/https://lists.gnu.org/archive/html/groff/2014-02/msg00109.html |archive-date=2023-03-05 |url-status=live}} who wrote a separate mdoc(7) converter.

Man pages are usually written in English, but translations into other languages may be available on the system. The GNU {{code|man-db}} and the mandoc {{code|man}} is known to search for localized manual pages under subdirectories.{{cite web |title=command line - Linux man pages in different languages |url=https://askubuntu.com/a/1113662 |website=Ask Ubuntu |access-date=2020-05-05 |archive-date=2023-03-11 |archive-url=https://web.archive.org/web/20230311130846/https://askubuntu.com/questions/1113648/linux-man-pages-in-different-languages/1113662 |url-status=live }}{{man|1|man|ManKier}}{{rp|at=Overview}}

= 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 TLDR pages (tldr) that provides simple examples for common use cases, similar to a cheatsheet.{{cite web |title=TLDR pages |url=https://tldr.sh/ |website=tldr.sh |access-date=2020-05-05 |archive-date=2020-04-27 |archive-url=https://web.archive.org/web/20200427081953/https://tldr.sh/ |url-status=live }}

In addition, some Unix GUI applications (particularly those built using the GNOME and KDE development environments) now provide end-user documentation in HTML and include embedded HTML viewers such as yelp for reading the help within the application. An HTML system in Emacs is also slated to replace texinfo.{{cite mailing list |title=Re: [Groff] man pages (tangential to Future Redux) |last=Raymond |first=Eric S. |author-link=Eric S. Raymond |url=https://lists.gnu.org/archive/html/groff/2014-02/msg00104.html |via=lists.gnu.org |access-date=2023-03-05 |archive-date=2023-03-05 |archive-url=https://web.archive.org/web/20230305171106/https://lists.gnu.org/archive/html/groff/2014-02/msg00104.html |url-status=live |mailing-list=groff}}

See also

References

{{Reflist}}