CLI Reference > CLI Usage Overview > man
 
man
display online reference pages
Synopsis
man [-wx] [-M path] [type] entry ...
man [-wx] [-T txt_indexes] [type] entry ...
man -h [-wx] [-C chm_indexes] [type] entry ...
man -H [-wx] [-P html_paths] [type] entry ...
man -k [-M path] keyword ...
Description
The man command either displays online reference pages or searches for reference pages that have specified keywords associated with them.
Normally, man displays the reference page for each specified entry. To display only a reference page of a given type, specify type on the command line. type is a number representing which type of reference pages to search. Reference pages come in the following types:
1 Commands and Utilities
3 Functions
4 File Formats
5 Miscellaneous
To indicate an operating system specific version of the entry (if one exists) or to indicate an command specific to a given set of commands and/or functions, append one of the following letters to the specified type:
n for Windows NT/2000/2003/Vista/7/2008 R2
t for Tcl
When output is sent to the terminal, man invokes a pager command to filter and display the reference pages. If MANPAGER is defined, it is used. If not, and if PAGER is defined, it is used. If neither is defined, man defaults to using the command more -A -s.
Options
-C filelist
specifies a list of .idx files (corresponding to .chm files) to search instead of searching the files listed in MAN_CHM_INDEX.
-H
launches the default web browser and displays the HTML version of the reference page. The reference page is found by searching each path listed in the MAN_HTM_PATHS environment variable (or indicated by the -P option) for an entry matching entry and type that indicates which page in the corresponding .chm file to display.
-h
launches the HTML Help viewer and displays the HTML Help version of the reference page. The reference page is found by searching each .idx listed in the MAN_CHM_INDEX environment variable (or indicated by the -C option) for an entry matching entry and type that indicates which page in the corresponding .chm file to display.
-k
searches a precomputed database of synopsis lines for information on keywords.
-M path
searches the directories indicated by path for reference pages. If -M is not specified, man uses the path specified in the MANPATH environment variable if it is set; otherwise man searches $ROOTDIR/etc. All reference pages are found by searching similarly structured file trees rooted at one or more places. See the “Files” section belowfor a description of the files and directories man should find in each directory that it searches.
-P html_paths
specifies a list of HTML paths to search instead of searching the paths listed in MAN_HTM_PATHS when looking for a HTML version of a reference page.
If this option is not specified and MAN_HTM_PATHS is not set, man searches $ROOTDIR/etc/htm by default. All reference pages are found by searching similarly structured file trees rooted at one or more places. See the “Files” section below for a description of the files and directories man should find in each directory that it searches.
-T filelist
specifies a list of .idx files to search instead of searching the files listed in MAN_TXT_INDEX when looking for a text version of a reference page.
-w
displays only the file name of the file containing the specified entry.
-x
displays the files that man is searching as it tries to find the entry.
Search Rules
To find a given entry, man follows a set of search rules. When you specify a type, man searches for the appropriate page amongst pages of that type; otherwise, man looks for the first page named entry regardless of the type.
When the -h option is specified, man searches the .idx files listed in the MAN_CHM_INDEX environment variable for an entry matching the specified entry which indicates the HTML Help page in corresponding .chm to display. The HTML Help viewer is launched, displaying the page. Once you exit, the view, the man command exits.
When the -H is specified, man takes the following steps to find the entry. Once found, man launches the default web browser to display the reference page.
For each possible type (that is, type if you specified it, or all types in order from 1 through 9, then 0 if you did not),
man checks each directory in MAN_HTM_PATHS (or specified by -P) for a file named htmn/entry.n[l].html (or if that file is not found, htmn/entry.n[l].htm) where n is the type number, and l is the optional letter code.
If still not found, man checks each directory in MAN_HTM_PATHS (or specified by -P) for a file named entry.html (or if that file is not found, entry.htm).
When neither -H nor -h is specified, man takes the following steps to find the entry. Once a step results in finding the entry, man displays the reference page and exits.
For each possible type (that is, type if you specified it, or all types in order from 1 through 9, then 0 if you did not):
man checks each directory in MANPATH for a file named catn/entry.n[l]where n is the type number, and l is the optional letter code. If it exists, man checks to see if it was compressed with pack, compress or mkszip, and uncompresses it (calling pcat if the file was packed).
man checks each directory in MANPATH for a file named mann/entry.n[l].
man checks each directory in MANPATH for a file named man.dbz. If it exists, man looks for the requested entry in its index (see “man.dbz File Format” below).
man searches the .idx files listed in the MAN_TXT_INDEX environment variable for an entry matching the request entry which indicates the text (.txt) reference page to display.
man.dbz File Format
Sometimes, the reference pages are kept in a single large file, called man.dbz. The file starts with a magic text string:
!<man database compressed>\n
and continues with the index:
14 bytes formatted reference page name
9 bytes seek pointer
9 bytes length
The name is simply the page name, followed by a dot and the type number. For example, this reference page would be named man.1. When man finds a matching entry, it seeks to the point in the file specified by the given seek pointer, and uncompresses for length bytes. Each reference page is compressed separately.
Examples
To find the utilities that do comparisons, type:
man -k compar
Environment Variables
MAN_CHM_INDEX
contains a semicolon separated list of .idx files to search for entry when the -h is specified.
MAN_TXT_INDEX
contains a semicolon separated list of .idx files to search for entry when the -h is not specified.
MAN_HTM_PATHS
contains a semicolon separated list of .idx paths to search for entry when the -H is specified.
MANPATH
contains a semicolon separated list of paths to search for reference pages.
MANPAGER, PAGER
contains an output filtering command for use when displaying reference pages on a terminal.
TMPDIR
identifies the directory where temporary files reside.
Files
$ROOTDIR/etc
is the default directory for the online reference pages. The rest of the files listed here reside in this directory.
cat[0-9]/*.[0-9]
pre-formatted reference pages in normal, compressed, or packed form.
htm/htm[0-9]/*.[0-9]
HTML reference pages.
man[0-9]/*.[0-9]
unformatted reference pages.
* 
Unformated reference pages are not currently supported. Reference pages stored in these directories are treated as pre-formatted pages.
whatis
is a database used by -k option.
*.chm
chm/*.chm
HTML Help files containing collections of reference pages complete with index, table of contents, and full text search.
*.idx
chm/*.idx
index files that man how to find HTML Help and text versions of individual reference files. The .idx files to search are indicated by the MAN_CHM_INDEX and MAN_TXT_INDEX environment variables.
man.dbz
is a master file containing all reference pages.
The etc directory is found using the ROOTDIR environment variable.
Diagnostics
Possible exit status values are:
0
Successful completion.
1
Failure due to any of the following:
— unknown command line option
— missing path after an -M option
— no information available on the desired subject
— unable to create a child process to format reference page
— child process returned with non-zero exit status
Portability
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 2000. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008 R2.
The -C, -H, -h, -M, -P, -T, -w, and -x options, the MANPAGER, MAN_HTM_PATHS, MAN_CHM_INDEX, and MAN_TXT_INDEX environment variables, the default pager, the ability to specify type on the command line, and the ability to display reference pages in HTML Help format are all extensions to the POSIX and XPG standards.
AVAILABILITY
MKS Toolkit for Power Users
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
Integrity Lifecycle Manager
See Also
Commands: help, manstrip, more