Man page

Man page
The man page on man

Man pages (short for manual pages) are the extensive documentation that comes preinstalled with almost all substantial Unix and Unix-like operating systems. The Unix command used to display them is man. Each page is a self-contained document.

Contents

Usage

To read a manual page for a Unix command, one can use

 man <command_name>

at a shell prompt: for example, "man ftp". In order to simplify navigation through the output, man generally uses the less terminal pager.

Pages are traditionally referred to using the notation "name(section)": for example, ftp(1). The same page name may appear in more than one section of the manual, 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 Linux and *BSD, for example, the syntax for reading printf(3) is

 man 3 printf

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

History

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 of Doug McIlroy in 1971. The troff macros used for man pages (-mm) were the general-purpose ones written by Ted Dolotta (later to be the first manager of USG and the principal author of the System III manual), with additions for the manuals. 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 its man page, and many Unix users perceive a 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.

Few alternatives to man have enjoyed much popularity, with the possible exception of GNU Project's "info" system, an early and simple hypertext system. Also 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.

Usually the man pages are written in English. Translations into other languages can be also available on the system.

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

The man package on most modern linux distributions includes the man2html command which can be used to enable users to browse their man pages using a 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.

Manual sections

The manual is generally split into eight numbered sections, organized as follows (on BSD, Unix and Linux):

Section Description
1 General commands
2 System calls
3 C library functions
4 Special files (usually devices, those found in /dev) and drivers
5 File formats and conventions
6 Games and screensavers
7 Miscellanea
8 System administration commands and daemons

Unix System V uses a similar numbering scheme, except in a different order:

Section Description
1 General commands
1M System administration commands and daemons
2 System calls
3 C library functions
4 File formats and conventions
5 Miscellanea
6 Games and screensavers
7 Special files (usually devices, those found in /dev) and drivers

On some systems some of the following sections are available:

Section Description
0 C library header files
9 Kernel routines
n Tcl/Tk keywords
x The X Window System

The sections are further subdivided by means of a suffix letter, such that 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:

Subsection Description
p POSIX specifications
x X Window System documentation

Some versions of man cache the formatted versions of the last several pages viewed.

To see options you can use with command man, enter the command man man.

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, you get 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 definition. For experienced users, this may be all the documentation they need.
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, ENVIRONMENT, KNOWN BUGS, FILES, AUTHOR, REPORTING BUGS, HISTORY and COPYRIGHT.

Writing man pages

On Apple Mac OS X and GNU/Linux systems, two groff macro packages are available for use in writing manual pages, man and mdoc. The man macro package is older and is the traditional macro package used to write manual pages on UNIX systems, whereas the mdoc package is newer and offers more support for semantic structuring of documents. The commands man groff_man and man groff_mdoc may be used in Mac OS X and GNU/Linux to bring up the online documentation (man pages) for using the man and mdoc macro packages, respectively.

In addition, one can simply inspect the source code for man pages installed on the system to see how they are written, typically found in /usr/share/man and other directories on Mac OS X and GNU/Linux systems. (To find the location of the manual page source file for command command, type man -w command.)

Man pages can also be written in DocBook or LinuxDoc format, then converted to groff.

Converting man pages

Besides viewing manual pages online (with man), man pages may also readily be converted to PDF format for immediate printing. In Mac OS X and GNU/Linux (with command replaced by the name of the desired command):

 groff -mandoc command.1 >command.ps
 gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=command.pdf command.ps

The former command exports the manual page to PostScript format, while the latter then converts the resulting PostScript file to PDF. (The above works for both man- and mdoc-formatted manual pages.) In some cases, the hardcopy version of the manual page may be more readable if printed using a monospaced font; to do so, add the option -f C after the -mandoc option in the groff command above.

The mandoc formatter directly supports PDF:

 mandoc -Tpdf command.1 >command.1.pdf
 mandoc -Tps command.1 >command.1.ps
 mandoc -Txhtml command.1 >command.1.xhtml

See also

External links

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.


Wikimedia Foundation. 2010.

См. также в других словарях:

  • Man page — Manpages (Abkürzung für Manual Page, deutsch: Handbuch Seite) sind Hilfe und Dokumentationsseiten unter UNIX und verwandten Betriebssystemen. Die Manpage zu man Die Manpage zu …   Deutsch Wikipedia

  • man page — n. Computing a document forming part of the online documentation of a computer system Origin: short for manual page …   Useful english dictionary

  • man page — noun A helpfile in the Unix operating system …   Wiktionary

  • MAN page — manual file, file in UNIX which accompanies a program and explains its operation (Computers) …   English contemporary dictionary

  • Man (Unix) — Pour les articles homonymes, voir man. Capture d écran de la page de manuel en anglais de la commande man man est une commande …   Wikipédia en Français

  • Man (commande UNIX) — man (Unix) Pour les articles homonymes, voir man. Capture d écran de la page de manuel en anglais de la commande man man est une commande …   Wikipédia en Français

  • Man (commande Unix) — man (Unix) Pour les articles homonymes, voir man. Capture d écran de la page de manuel en anglais de la commande man man est une commande …   Wikipédia en Français

  • man (Unix) — Pour les articles homonymes, voir man. Capture d écran de la page de manuel en anglais de la commande man man est une commande disponible sur les systèmes d exploitati …   Wikipédia en Français

  • Man (Neneh Cherry album) — Man Studio album by Neneh Cherry Released September 2, 1996 …   Wikipedia

  • Man — Cette page d’homonymie répertorie les différents sujets et articles partageant un même nom.  Pour les articles homophones, voir Mane, Manne, Mann, Mahn et Mânes …   Wikipédia en Français


Поделиться ссылкой на выделенное

Прямая ссылка:
Нажмите правой клавишей мыши и выберите «Копировать ссылку»