|HP-UX Reference > M
HP-UX 11i Version 3: February 2007
man — find manpage information by keywords; print out a manpage
man [-M path] -k keyword...
man [-M path] -f file...
man [-] [-M path] [-T macro-package] [section[subsection]] entry_name...
man accesses information from the HP-UX manpages. It can be used to:
Searching for Entry Names by Keyword (first form)
The first form above searches the one-line descriptions of individual manpages for specified keywords. Arguments are as follows:
Obtaining One-Line Description of an Entry (second form)
The second form above finds and displays or prints the one-line descriptions of specified individual manpages. Arguments are as follows:
Viewing Individual Manpages (third form)
The third form shown above is used for viewing one or more individual manpages. man in this form recognizes the following arguments:
If the standard output is a teletype, and if the - flag is not given, man pipes its output through more (see more(1)), with the -s option, to eliminate multiple blank lines and stop after each screenful. This default behavior can be changed by setting the PAGER variable in the user's environment. The value of PAGER must be a string that names an output filter (such as pg(1)), along with the desired options.
File Search Conventions
man searches in several directories, as appropriate, for the specified manpage. The search continues until either the manpage is found or all candidate directories are searched. The first three directories searched, in order, are: /usr/share/man, /usr/contrib/man, and /usr/local/man.
The MANPATH environment variable can be used to specify directories to be searched, and, if set, overrides the default paths given above. Upon logging in, /etc/profile ( or /etc/csh.login ) sets the MANPATH environment variable to default settings. If the file /etc/MANPATH exists, the default settings are taken from this file. The MANPATH variable follows the same form as the PATH variable (see environ(5)).
Within each of these directories, man searches in the cat*.Z subdirectories, the man*.Z subdirectories, the cat* subdirectories, and the man* subdirectories. man*.Z and man* directories contain nroff(1)-compatible source text for the manpages. cat*.Z and cat* directories contain the formatted versions of the manpages. man*.Z and cat.Z directories contain manpages in compressed form. Files in these directories are uncompressed by uncompress (see compress(1)) before being processed for printing or display.
If the LANG environment variable is set to any valid language name defined by lang(5), and the MANPATH variable is not set, or is set to the default directories, man searches in three additional directories for the manpage before searching in /usr/share/man. First, man searches in /usr/share/man/$LANG, then in /usr/contrib/man/$LANG, then in /usr/local/man/$LANG. Thus, native-language manpages are displayed if they are present and installed properly in the system.
If the MANPATH environment variable is set to anything other than the default, the above directories with $LANG as part of the path are not automatically searched. All directories must be explicitly given in MANPATH. The %L, %l, %t, and %c specifiers can be used as path components to cause locale-specific directories to be searched. See environ(5) for a complete description of MANPATH.
man uses the most recent version that it finds in the subdirectories searched. If the most recent version is in:
If only the cat* or cat*.Z subdirectory is present and/or nroff(1) is not installed, only manpages that are already formatted can be displayed.
To improve man performance, you can run the catman(1M) command to create the formatted manpages in the cat* directories. Running catman with the default creates the cat*.Z directories (after removing any cat* directories that exist on your system) and also creates the file /usr/share/lib/whatis used by the man -k option. If you choose to have the cat* directories, it would be space-saving to remove any cat*.Z directories that may exist on your system. Beware that man updates both directories (cat* and cat*.Z) if they both exist.
Some situations may require creation of manpages for local use or distribution by third-party software suppliers. The manpage formatting macros have been structured to redefine page footers so that manpages not originating from Hewlett-Packard Company do not show the HP name in the footer. For more information about this change and a description of the manpage formatting macros used with nroff or troff, see man(5).
LANG determines the language in which messages are displayed. LANG is also used to determine the search path (as described above).
If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG for messages, but not for the search path.
If any internationalization variable contains an invalid setting, man behaves as if all internationalization variables are set to "C". See environ(5).
MANPATH, if set, gives a list of directories to be searched for the given manpage, replacing the default paths.
PAGER, if set, defines an output filter to be used instead of more(1) to paginate output.
List the manpages that contain the word grep in their respective one-line description (NAME) lines:
man -k grep
The output is:
grep, egrep, fgrep (1) - search a file for a pattern zgrep(1) - search possibly compressed files for a regular expression
Print the one-line description of the grep(1) manpage:
man -f grep
Print the entire grep(1) manpage:
Set a search path that includes a path directly below the current directory. The manpage, mypage is assumed to exist in the directory ./man1 (or ./man1.Z, cat1, or cat1.Z).
MANPATH=.:/usr/share/man:/usr/contrib/man:/usr/local/man export MANPATH man mypage
Display the manpage for id(1), with the output piped through pg -c:
PAGER="pg -c" export PAGER man id
man 4 intro man 7 intro
Manpages are structured such that they can be printed on a phototypesetter, conventional line printer, and screen display devices. However, due to line printer and display device limitations, some information may be lost in certain situations.