Man page

Last updated
The man page for the
.mw-parser-output .monospaced{font-family:monospace,monospace}
sed utility, as seen in various Linux distributions. Sed stream editor (cropped).jpg
The man page for the sed utility, as seen in various Linux distributions.

A man page (short for manual page) is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts. A user may invoke a man page by issuing the man command.

Contents

By default, man typically uses a terminal pager program such as more or less to display its output.

Man pages are often referred to as an on-line or online form of software documentation, [1] 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

xman, an early X11 application for viewing manual pages Screenshot of "Xman" program.png
xman, an early X11 application for viewing manual pages
OpenBSD section 8 intro man page, displaying in a text console OpenBSD Manpages Section 8 Intro.png
OpenBSD 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. [ citation needed ]

In the first two years of the history of Unix, no documentation existed. [2] The 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[ citation needed ] 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. [3]

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. [2] 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. [4]

For the Fourth Edition the man pages were formatted using the troff typesetting package [2] and its set of -man macros (which were completely revised between the Sixth and Seventh Editions of the Manual, [3] 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; 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 [5] but first restricted [6] and then removed in 2017 [7] after finally being found. [8]

Formatting

Part of the FreeBSD
man(1) manual page, typeset into PDF format FreeBSD typeset man page.png
Part of the FreeBSD 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 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 (man --html) instead. The GNU Emacs program WoMan (from "WithOut man") allows to browse man pages from the editor. [9]

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 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. [10] [11] [12]

For Linux, a man7.org service has been set up to serve manuals specific to the system. [13] A ManKier service provides a wider selection, and integrates the TLDR pages too. [14]

Command usage

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

man<command_name> 

Pages are traditionally referred to using the notation "name(section)": for example, ftp(1) . 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) and man(7) , or exit(2) and exit(3) . The syntax for accessing the non-default manual section varies between different man implementations.

On Solaris and illumos, for example, the syntax for reading printf(3C) is:

man-s3cprintf

On Linux and BSD derivatives the same invocation would be:

man3printf

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

Manual sections

The manual is generally split into eight numbered sections. Most systems today (e.g. BSD, [15] macOS, Linux, [16] and Solaris 11.4) inherit the numbering scheme used by Research Unix. [17] [18] While System V uses a different order: [19]

CommonSystem VDescription
11General commands
22 System calls
33 Library functions, covering in particular the C standard library
47 Special files (usually devices, those found in /dev) and drivers
54 File formats and conventions
66 Games and screensavers
75Miscellaneous
81MSystem 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 some of the following sections are available:

SectionDescription
0 C library header files (Unix v6)
9 Kernel routines (FreeBSD, SVR4, Linux) [18] [15]
l LAPACK library functions [20]
n Tcl/Tk commands
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 (system administration commands) is sometimes relegated to the 1M subsection of the main commands section. Some subsection suffixes have a general meaning across sections:

SubsectionDescription
p POSIX specifications
x X 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: [21] :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.
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 man macros, the new doc macros, or a combination of both (mandoc). [22] The 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. [23] The newer 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. [21] Both the mandoc and the groff projects consider mdoc the preferred format for new documents. [24]

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. [25] On the other hand, bold and italic text is supported by the terminal via ECMA-48, and groff's 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 less. [26] [27]

Some tools have been used to convert documents in a less contrived format to manual pages. Examples include GNU's help2man, which takes a --help output and some additional content to generate a manual page. [28] 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. [29] A number of tools, including pandoc, ronn, and md2man support conversion from Markdown to manual pages. All these tools emit the man format, as Markdown is not expressive enough to match the semantic content of mdoc. DocBook has an inbuilt man(7) converter of appalling quality, according to mandoc's author [30] 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 man-db and the mandoc man is known to search for localized manual pages under subdirectories. [31] [16] :Overview [15]

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. [32]

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. [33]

See also

Related Research Articles

<span class="mw-page-title-main">Executable and Linkable Format</span> Standard file format for executables, object code, shared libraries, and core dumps.

In computing, the Executable and Linkable Format, is a common standard file format for executable files, object code, shared libraries, and core dumps. First published in the specification for the application binary interface (ABI) of the Unix operating system version named System V Release 4 (SVR4), and later in the Tool Interface Standard, it was quickly accepted among different vendors of Unix systems. In 1999, it was chosen as the standard binary file format for Unix and Unix-like systems on x86 processors by the 86open project.

troff, short for "typesetter roff", is the major component of a document processing system developed by Bell Labs for the Unix operating system. troff and the related nroff were both developed from the original roff.

ls Command to list files and directories in Unix and Unix-like operating systems

In computing, ls is a command to list computer files and directories in Unix and Unix-like operating systems. It is specified by POSIX and the Single UNIX Specification.

In software development, Make is a command-line interface (CLI) software tool that performs actions ordered by configured dependencies as defined in a configuration file called a makefile. It is commonly used for build automation to build executable code from source code. But, not limited to building, Make can perform any operation available via the operating system shell.

pwd Directory information command on various operating systems

In Unix-like and some other operating systems, the pwd command writes the full pathname of the current working directory to the standard output.

The C standard library or libc is the standard library for the C programming language, as specified in the ISO C standard. Starting from the original ANSI C standard, it was developed at the same time as the C library POSIX specification, which is a superset of it. Since ANSI C was adopted by the International Organization for Standardization, the C standard library is also called the ISO C library.

The archiver, also known simply as ar, is a Unix utility that maintains groups of files as a single archive file. Today, ar is generally used only to create and update static library files that the link editor or linker uses and for generating .deb packages for the Debian family; it can be used to create archives for any purpose, but has been largely replaced by tar for purposes other than static libraries. An implementation of ar is included as one of the GNU Binutils.

Ctags is a programming tool that generates an index file of names found in source and header files of various programming languages to aid code comprehension. Depending on the language, functions, variables, class members, macros and so on may be indexed. These tags allow definitions to be quickly and easily located by a text editor, a code search engine, or other utility. Alternatively, there is also an output mode that generates a cross reference file, listing information about various names found in a set of language files in human-readable form.

pax is an archiving utility available for various operating systems and defined since 1995. Rather than sort out the incompatible options that have crept up between tar and cpio, along with their implementations across various versions of Unix, the IEEE designed a new archive utility pax that could support various archive formats with useful options from both archivers. The pax command is available on Unix and Unix-like operating systems and on IBM i, and Microsoft Windows NT until Windows 2000.

cksum Unix command

cksum is a command in Unix and Unix-like operating systems that generates a checksum value for a file or stream of data. The cksum command reads each file given in its arguments, or standard input if no arguments are provided, and outputs the file's 32-bit cyclic redundancy check (CRC) checksum and byte count. The CRC output by cksum is different from the CRC-32 used in zip, PNG and zlib.

rm (Unix) Unix command utility

rm is a basic command on Unix and Unix-like operating systems used to remove objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets, similar to the del command in MS-DOS, OS/2, and Microsoft Windows. The command is also available in the EFI shell.

init UNIX system component

In Unix-based computer operating systems, init is the first process started during booting of the operating system. Init is a daemon process that continues running until the system is shut down. It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes. Init is started by the kernel during the booting process; a kernel panic will occur if the kernel is unable to start it, or it should die for any reason. Init is typically assigned process identifier 1.

groff (software) Unix typesetting software used for man pages

groff is a typesetting system that creates formatted output when given plain text mixed with formatting commands. It is the GNU replacement for the troff and nroff text formatters, which were both developed from the original roff.

In computing, Pic is a domain-specific programming language by Brian Kernighan for specifying line diagrams. The language contains predefined basic linear objects: line, move, arrow, and spline, the planar objects box, circle, ellipse, arc, and definable composite elements. Objects are placed with respect to other objects or absolute coordinates. A liberal interpretation of the input invokes default parameters when objects are incompletely specified. An interpreter translates this description into concrete drawing commands in a variety of possible output formats. Pic is a procedural programming language, with variable assignment, macros, conditionals, and looping. The language is an example of a little language originally intended for the comfort of non-programmers in the Unix environment.

sum is a legacy utility available on some Unix and Unix-like operating systems. This utility outputs a 16-bit checksum of each argument file, as well as the number of blocks they take on disk. Two different checksum algorithms are in use. POSIX abandoned sum in favor of cksum.

<span class="mw-page-title-main">Unix</span> Family of computer operating systems

Unix is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.

In computing, apropos is a command to search the man page files in Unix and Unix-like operating systems. Apropos takes its name from the French "à propos" which means about. It is particularly useful when searching for commands without knowing their exact names.

printf (Unix) Standard UNIX utility

In Unix and Unix-like operating systems, printf is a shell builtin that formats and outputs text like the same-named C function.

mandoc is a utility used for formatting man pages in BSD Operating Systems, specifically those written in the mdoc and man macro languages. Unlike the groff and older troff and nroff tools that are predominantly used for this purpose by tools such as man, mandoc focuses specifically on manuals and is not suitable for general-purpose type-setting.

On Unix-like computer systems, seq is a utility for generating a sequence of numbers.

References

  1. "man(1)". FreeBSD General Commands Manual. Archived from the original on 2023-01-30. Retrieved 2023-07-15.
  2. 1 2 3 McIlroy, M. D. (1987). A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986 (PDF) (Technical report). CSTR. Bell Labs. 139. Archived (PDF) from the original on 2017-11-11. Retrieved 2015-02-01.
  3. 1 2 Darwin, Ian; Collyer, Geoffrey. "UNIX Evolution: 1975-1984 Part I - Diversity". Archived from the original on 17 July 2012. Retrieved 22 December 2012. Originally published in Microsystems5(11), November 1984.
  4. Fiedler, Ryan (October 1983). "The Unix Tutorial / Part 3: Unix in the Microcomputer Marketplace". BYTE. p. 132. Retrieved 30 January 2015.
  5. "GIT commit 002a6339b1fe8f83f4808022a17e1aa379756d99". Archived from the original on 4 December 2017. Retrieved 22 November 2017.
  6. "GIT commit 84bde8d8a9a357bd372793d25746ac6b49480525". Archived from the original on 5 September 2018. Retrieved 22 November 2017.
  7. "GIT commit b225d9e76fbb0a6a4539c0992fba88c83f0bd37e". Archived from the original on 9 November 2020. Retrieved 25 September 2018.
  8. ""Why does man print "gimme gimme gimme" at 00:30?"". Archived from the original on 21 November 2017. Retrieved 22 November 2017.
  9. Wright, Francis J. "WoMan: Browse Unix Manual Pages "W.O. (without) Man"". GNU. Archived from the original on 11 November 2020. Retrieved 3 August 2020.
  10. Pali, Gabor, ed. (12 May 2013). "FreeBSD Quarterly Status Report, January-March 2013". FreeBSD. Archived from the original on 22 December 2014. Retrieved 25 December 2014.
  11. Murenin, Constantine A. (19 February 2013). "announcing mdoc.su, short manual page URLs". freebsd-doc@freebsd.org (Mailing list). Archived from the original on 7 August 2014. Retrieved 25 December 2014.
  12. Murenin, Constantine A. (23 February 2013). "mdoc.su — Short manual page URLs for FreeBSD, OpenBSD, NetBSD and DragonFly BSD". Archived from the original on 17 December 2014. Retrieved 25 December 2014.
  13. "Linux man pages online". man7.org. Archived from the original on 2020-05-07. Retrieved 2020-05-05.
  14. "About". ManKier. Archived from the original on 2020-04-25. Retrieved 2020-05-05.
  15. 1 2 3 man(1)    FreeBSD General Commands Manual
  16. 1 2 man(1)    Linux General Commands Manual
  17. "Manual Pages for Research Unix Eighth Edition". man.cat-v.org. Archived from the original on 2020-06-30. Retrieved 2020-05-06.
  18. 1 2 "Unix Programmer's Manual - Introduction". www.bell-labs.com. November 3, 1971. Archived from the original on June 1, 2020. Retrieved May 6, 2020.
  19. "System V release 4 manuals". bitsavers.trailing-edge.com. Archived from the original on 2020-08-03. Retrieved 2020-05-06.
  20. "lapack (l) - Linux Man Pages". www.systutorials.com. Archived from the original on 2023-03-11. Retrieved 2021-05-29.
  21. 1 2 mdoc(7)    FreeBSD Miscellaneous Information Manual
  22. groff_tmac(5)    Linux File Formats Manual
  23. man(7)    Linux Miscellanea Manual
  24. "Groff Mission Statement - 2014". www.gnu.org. Archived from the original on 2020-12-03. Retrieved 2021-01-02. Concurrent with work on man(7), mdoc(7) will be actively supported and its use promoted.
  25. "man". The GNU Troff Manual. Archived from the original on 24 December 2019. Retrieved 31 December 2019.
  26. "Italics and colour in manual pages on a nosh user-space virtual terminal". jdebp.eu. Archived from the original on 2021-01-28. Retrieved 2021-01-21.
  27. mandoc(1)    FreeBSD General Commands Manual. "Font styles are applied by using back-spaced encoding..."
  28. "help2man Reference Manual". Archived from the original on 6 March 2023. Retrieved 5 March 2023.
  29. "Man Pages (GNU Coding Standards)". www.gnu.org. Archived from the original on 2023-03-05. Retrieved 2023-03-05.
  30. Ingo Schwarze. "New mandoc -mdoc -T markdown converter". undeadly.org. Archived from the original on 2023-03-05. Retrieved 2023-03-05. for specific complaints by the author, see Ingo Schwarze (28 February 2014). "Re: Groff man pages (tangential to Future Redux)". Groff (Mailing list). Archived from the original on 2023-03-05.
  31. "command line - Linux man pages in different languages". Ask Ubuntu. Archived from the original on 2023-03-11. Retrieved 2020-05-05.
  32. "TLDR pages". tldr.sh. Archived from the original on 2020-04-27. Retrieved 2020-05-05.
  33. Raymond, Eric S. "Re: [Groff] man pages (tangential to Future Redux)". groff (Mailing list). Archived from the original on 2023-03-05. Retrieved 2023-03-05 via lists.gnu.org.