Section: Manual pager utils (1)
Updated: 07 September 2001
Return to Main Contents
man - an interface to the on-line reference manuals
page ...] ...
is the system's manual pager. Each
argument given to
is normally the name of a program, utility or function.
associated with each of these arguments is then found and displayed. A
if provided, will direct
to look only in that
of the manual.
The default action is to search in all of the available
following a pre-defined order and to show only the first
found, even if
exists in several
The table below shows the
numbers of the manual followed by the types of pages they contain.
|1||Executable programs or shell commands|
|2||System calls (functions provided by the kernel)|
|3||Library calls (functions within system libraries)|
|4||Special files (usually found in /dev)|
|5||File formats and conventions eg /etc/passwd|
|7||Macro packages and conventions eg man(7), groff(7).|
|8||System administration commands (usually only for root)|
|9||Kernel routines [Non standard]|
consists of several parts.
They may be labelled
The following conventions apply to the
section and can be used as a guide in other sections.
|bold text||type exactly as shown.|
|italic text||replace with appropriate argument.|
|[-abc]||any or all arguments within [ ] are optional.|
|-a|-b||options delimited by | cannot be used together.|
|argument ...||argument is repeatable.|
|[expression] ...||entire expression within [ ] is repeatable.|
The command or function illustration is a pattern that should match all
In some cases it is advisable to illustrate several exclusive invocations
as is shown in the
section of this manual page.
- man ls
Display the manual page for the
- man -a intro
Display, in succession, all of the available
manual pages contained within the manual.
It is possible to quit between successive displays or skip any of them.
- man -t alias | lpr -Pps
Format the manual page referenced by
usually a shell manual page, into the default
format and pipe it to the printer named
The default output for
is usually PostScript.
should advise as to which processor is bound to the
- man -l -Tdvi ./foo.1x.gz > ./foo.1x.dvi
This command will decompress and format the nroff source manual page
device independent (dvi)
The redirection is necessary as the
flag causes output to be directed to
with no pager.
The output could be viewed with a program such as
or further processed into PostScript using a program such as
- man -k printf
Search the short descriptions and manual page names for the keyword
as regular expression.
Print out any matches.
apropos -r printf.
- man -f smail
Lookup the manual pages referenced by
and print out the short descriptions of any found.
whatis -r smail.
Many options are available to
in order to give as much flexibility as possible to the user.
Changes can be made to the search path, section order, output processor,
and other behaviours and operations detailed below.
If set, various environment variables are interrogated to determine
the operation of
It is possible to set the `catch all' variable
to any string in command line format with the exception that any spaces
used as part of an option's argument must be escaped (preceded by a
prior to parsing its own command line.
Those options requiring an argument will be overridden by the same options
found on the command line.
To reset all of the options set in
can be specified as the initial command line option.
This will allow man to `forget' about the options specified in
although they must still have been valid.
The manual pager utilities packaged as
make extensive use of
These caches contain information such as where each manual page can be
found on the filesystem and what its
(short one line description of the man page) contains, and allow
to run faster than if it had to search the filesystem each time to find the
appropriate manual page.
If requested using the
will ensure that the caches remain consistent, which can obviate the
need to manually run software to update traditional
cannot find a
database for a particular manual page hierarchy, it will still search for
the requested manual pages, although file globbing will be necessary to
search within that hierarchy.
fails to find an
it will try to extract information from a traditional
These utilities support compressed source nroff files having, by default, the
.Z, .z and .gz.
It is possible to deal with any compression extension, but this information
must be known at compile time.
Also, by default, any cat pages produced are compressed using
Each `global' manual page hierarchy such as
may have any directory as its cat page hierarchy.
Traditionally the cat pages are stored under the same hierarchy as the man
pages, but for reasons such as those specified in the
File Hierarchy Standard (FHS),
it may be better to store them elsewhere.
For details on how to do this, please read
For details on why to do this, read the standard.
International support is available with this package.
Native language manual pages are accessible (if available on your system)
via use of
To activate such support, it is necessary to set either
or another system dependent environment variable to your language locale,
usually specified in the
If the desired page is available in your
it will be displayed in lieu of the standard (usually American English)
Support for international message catalogues is also featured in this
package and can be activated in the same way, again if available.
If you find that the manual pages and message catalogues supplied with this
package are not available in your native language and you would like to
supply them, please contact the maintainer who will be coordinating such
For information regarding other features and extensions available with this
manual pager, please read the documents supplied with the package.
will search for the desired manual pages within the
database caches. If the
option is given, a cache consistency check is performed to ensure the
databases accurately reflect the filesystem.
If this option is always given, it is not generally necessary to run
after the caches are initially created, unless a cache becomes corrupt.
However, the cache consistency check can be slow on systems with many
manual pages installed, so it is not performed by default, and system
administrators may wish to run
every week or so to keep the database caches fresh.
To forestall problems caused by outdated caches,
will fall back to file globbing if a cache lookup fails, just as it would
if no cache was present.
Once a manual page has been located, a check is performed to find out if a
relative preformatted `cat' file already exists and is newer than the nroff
If it does and is, this preformatted file is (usually) decompressed and then
displayed, via use of a pager.
The pager can be specified in a number of ways, or else will fall back to a
default is used (see option
If no cat is found or is older than the nroff file, the nroff is filtered
through various programs and is shown immediately.
If a cat file can be produced (a relative cat directory exists and has
will compress and store the cat file in the background.
The filters are deciphered by a number of means. Firstly, the command
or the environment variable
is interrogated. If
was not used and the environment variable was not set, the initial line of
the nroff file is parsed for a preprocessor string.
To contain a valid preprocessor string, the first line must resemble
can be any combination of letters described by option
If none of the above methods provide any filter information, a default set
A formatting pipeline is formed from the filters and the primary
Alternatively, if an executable program
exists in the man tree root, it is executed instead.
It gets passed the manual source file, the preprocessor string, and
optionally the device specified with
Non argument options that are duplicated either on the command line, in
or both, are not harmful.
For options that require an argument, each duplication will override the
previous argument value.
- -l, --local-file
Activate `local' mode.
Format and display local manual files instead of searching through the
system's manual collection.
Each manual page argument will be interpreted as an nroff source file in the
No cat file is produced.
If '-' is listed as one of the arguments, input will be taken from stdin.
When this option is not used, and man fails to find the page required,
before displaying the error message, it attempts to act as if this
option was supplied, using the name as a filename and looking for an
- -L locale, --locale=locale
will normally determine your current locale by a call to the C function
which interrogates various environment variables, possibly including
To temporarily override the determined value, use this option to supply a
string directly to
Note that it will not take effect until the search for pages actually
Output such as the help message will always be displayed in the initially
- -D, --default
This option is normally issued as the very first option and resets
behaviour to its default.
Its use is to reset those options that may have been set in
Any options that follow
will have their usual effect.
- -M path, --manpath=path
Specify an alternate manpath to use.
derived code to determine the path to search.
This option overrides the
environment variable and causes option
to be ignored.
A path specified as a manpath must be the root of a manual page hierarchy
structured into sections as described in the man_db manual (under "The
manual page system").
To view manual pages outside such hierarchies, see the
- -P pager, --pager=pager
Specify which output pager to use.
exec /usr/bin/pager -s.
This option overrides the
environment variable and is not used in conjunction with
- -r prompt, --prompt=prompt
If a recent version of
is used as the pager,
will attempt to set its prompt and some sensible options.
The default prompt looks like
Manual page name(sec) line x
denotes the manual page name,
denotes the section it was found under and
the current line number.
This is achieved by using the
with a string will override this default.
The string may contain the text
which will be expanded to the name of the current manual page and its
section name surrounded by `(' and `)'.
The string used to produce the default could be expressed as
\ Manual\ page\ \$MAN_PN\ ?ltline\ %lt?L/%L.:
byte\ %bB?s/%s..?\ (END):?pB %pB\\%..
It is broken into two lines here for the sake of readability only.
For its meaning see the
The prompt string is first evaluated by the shell.
All double quotes, back-quotes and backslashes in the prompt must be escaped
by a preceding backslash.
The prompt string may end in an escaped $ which may be followed by further
options for less.
- -7, --ascii
When viewing a pure
manual page on a 7 bit terminal or terminal emulator, some characters may
not display correctly when using the
device description with
This option allows pure
manual pages to be displayed in
It will not translate any
The following table shows the translations performed.
|bullet (middle dot)||267||*||o|
column displays correctly, your terminal may be set up for
characters and this option is not necessary.
columns are identical, you are reading this page using this option or
did not format this page using the
column is missing or corrupt, you may need to view manual pages with this
This option is ignored when using options
and may be useless for
- -S list, --sections=list
List is a colon-separated list of `order specific' manual sections to search.
This option overrides the
- -a, --all
will exit after displaying the most suitable manual page it finds.
Using this option forces
to display all the manual pages with names that match the search criteria.
- -c, --catman
This option is not for general use and should only be used by the
- -d, --debug
Don't actually display any manual pages, but do print lots of debugging
- -e sub-extension, --extension=sub-extension
Some systems incorporate large packages of manual pages, such as those that
package, into the main manual page hierarchy.
To get around the problem of having two manual pages with the same name
pages were usually all assigned to section
As this is unfortunate, it is now possible to put the pages in the correct
section, and to assign a specific `extension' to them, in this case,
Under normal operation,
in preference to
To negotiate this situation and to avoid having to know which section the
page you require resides in, it is now possible to give
string indicating which package the page must belong to.
Using the above example, supplying the option
will restrict the search to pages having an extension of
- -f, --whatis
Display a short description from the manual page, if available. See
- -h, --help
Print a help message and exit.
- -k, --apropos
Search the short manual page descriptions for keywords and display any
If this system has access to other operating system's manual pages, they can
be accessed using this option.
To search for a manual page from NewOS's manual page collection,
use the option
specified can be a combination of comma delimited operating system names.
To include a search of the native operating system's manual pages,
include the system name
in the argument string.
This option will override the
- -p string, --preprocessor=string
Specify the sequence of preprocessors to run before
Not all installations will have a full set of preprocessors.
Some of the preprocessors and the letters used to designate them are:
This option overrides the
is always run as the very first preprocessor.
- -u, --update
This option causes
to perform an `inode level' consistency check on its database caches to
ensure that they are an accurate representation of the filesystem.
It will only have a useful effect if
is installed with the setuid bit set.
- -t, --troff
to format the manual page to stdout.
This option is not required in conjunction with
-T device, --troff-device
This option is used to change
output to be suitable for a device other than the default.
Examples (provided with Groff-1.09) include
X75 and X100.
- -Z, --ditroff
and then use an appropriate post-processor to produce output suitable for
the chosen device.
this option is passed to
and will suppress the use of a post-processor.
- -H, --html
This option will cause
to produce HTML output, and will display that output in a web browser.
The choice of browser is determined by the
environment variable, or by a compile-time default if that is unset (usually
This option implies
and will only work with
- -w, --where, --location
Don't actually display the manual pages, but do print the location(s) of
the files that would be formatted or displayed.
If the file is a cat file, also show the location of its source nroff file.
- -V, --version
Display version information.
Successful program execution.
Usage, syntax or configuration file error.
A child process returned a non-zero exit status.
At least one of the pages/files/keywords didn't exist or wasn't matched.
is set, its value is used as the path to search for manual pages.
is set, its value is used to determine the set of preprocessors to pass
each manual page through.
The default preprocessor list is system dependent.
is set, its value is a colon-delimited list of sections and it is used to
determine which manual sections to search and in what order.
is set, its value is used as the name of the program used to display
the manual page.
exec /usr/bin/pager -s
is set, its value is a colon-delimited list of commands, each of which in
turn is used to try to start a web browser for
In each command,
is replaced by a filename containing the HTML output from
is replaced by a single percent sign (%), and
is replaced by a colon (:).
is set, it will have the same effect as option
where string will be taken as
is set, it will be parsed prior to
command line and is expected to be in a similar format.
As all of the other
specific environment variables can be expressed as command line options, and
are thus candidates for being included in
it is expected that they will become obsolete.
N.B. All spaces that should be interpreted as part of an option's argument
must be escaped.
is set, its value is used as the line length for which manual pages should
If it is not set, manual pages will be formatted with a line length
appropriate to the current terminal (using an
if available, the value of
or falling back to 80 characters if neither is available).
Cat pages will only be saved when the default formatting can be used, that
is when the terminal line length is between 66 and 80 characters.
- LANG, LC_MESSAGES
Depending on system and implementation, either or both of
will be interrogated for the current message locale.
will display its messages in that locale (if available).
for precise details.
man_db configuration file.
A global manual page hierarchy.
A traditional global
An alternate or FHS
the man_db package manual,
1990, 1991 - Originally written by John W. Eaton (firstname.lastname@example.org).
Dec 23 1992: Rik Faith (email@example.com) applied bug fixes
supplied by Willem Kasdorp (firstname.lastname@example.org).
30th April 1994 - 23rd February 2000: Wilf.
(G.Wilford@ee.surrey.ac.uk) has been developing and maintaining this package
with the help of a few dedicated people.
30th October 1996 - 30th March 2001: Fabrizio Polacco <email@example.com>
maintained and enhanced this package for the Debian project, with the
help of all the community.
31st March 2001 - 07 September 2001: Colin Watson <firstname.lastname@example.org> is now
developing and maintaining man-db.
- EXIT STATUS
- SEE ALSO
This document was created by
using the manual pages.
Time: 03:37:04 GMT, August 02, 2002