- find and display reference manual pages
man [-] [-adFlrt] [-M path] [-T macro-package] [-s section] name...
man [-M path] [-s section] -k query...
man [-M path] -f file...
man [-M path] [-s section] -K query...
The man command displays information from the reference manuals. It displays complete manual pages that you select by name, or one-line summaries selected either by query (-k or -K), or by the name of an associated file (-f). If no manual page is located, man prints an error message.
Reference Manual pages are marked up with either nroff (see nroff(1)) or SGML (Standard Generalized Markup Language) tags (see sgml(5)). The man command recognizes the type of markup and processes the file accordingly. The various source files are kept in separate directories depending on the type of markup.
The online Reference Manual page directories are conventionally located in /usr/share/man. The nroff sources are located in the /usr/share/man/man* directories. The SGML sources are located in the /usr/share/man/sman* directories. Each directory corresponds to a section of the manual. Since these directories are optionally installed, they might not reside on your host. You might have to mount /usr/share/man from a host on which they do reside.
If there are preformatted, up-to-date versions in the corresponding cat* or fmt* directories, man simply displays or prints those versions. If the preformatted version of interest is out of date or missing, man reformats it prior to display and stores the preformatted version if cat* or fmt* is writable. The index files are not updated. See catman(1M). If directories for the preformatted versions are not provided, man reformats a page whenever it is requested. man uses a temporary file to store the formatted text during display.
If the standard output is not a terminal, or if the `-' flag is given, man pipes its output through cat(1). Otherwise, man pipes its output through more(1) to handle paging and underlining on the screen.
Using -k or -K options, manual pages can be searched with query, one or more terms or phrases. It supports index-file-based, full text searching, stemming, and section matching. For information regarding how to generate the index files, refer to catman(1M) and man(5).
Stemming for English, for example, identifies the string cats, catlike, catty, and so forth, based on the root cat. It identifies stemmer, stemming, and stemmed based on stem. A stemming algorithm reduces the words fishing, fished, fish, and fisherto the root word, fish.
Matching is done in case-insensitive manner. Stemming is done for English manual pages only.
Matched manual pages are sorted and presented based on the score of the query matches in ascending order.
Oracle Solaris manual pages are divided into sections such as NAME, SYNOPSIS, DESCRIPTION, and so forth. Users can specify the scope of search into a section as details described in the -K option.
The following options are supported:
Shows all manual pages matching name within the MANPATH search path. Manual pages are displayed in the order found.
Debugs. Displays what a section-specifier evaluates to, method used for searching, and paths searched by man.
man attempts to locate manual pages related to any of the given files. It strips the leading path name components from each file, and then prints one-line summaries containing the resulting basename or names.
Forces man to search all directories specified by MANPATH or the man.cf file, rather than using the index lookup files. This option is useful if the index files are not up to date and they have been made the default behavior of the man command. The option therefore does not have to be invoked and is documented here for reference only.
Prints out one-line summaries from the index files.
See the -K option for information regarding how the index files are generated. If there are no index files, manual page files are directly looked up, therefore yielding slower response time than cases where index files exist.
Search for the specified query from the index files. If there are no index files, search is directly done on the manual pages, which causes a much slower search.
If you supply a section name ending with a colon (:) at the query option argument as the first text from left, just as section name: query, the search for the query string is done on the specified section only. If the specified section name does not exist, it will list all the supported section name for users.
The index files in /usr/share/man and /usr/gnu/share/man used by -f, -k, and -K are automatically generated when man pages in those directories are installed or updated and the packages delivering them have tagged the files with restart_fmri=svc:/application/man-index:default as specified in pkg(5). They may also be generated by running svcadm restart application/man-index manually, or running catman(1M) with the -w.
Lists all manual pages found matching name within the search path.
Specifies an alternate search path for manual pages. path is a colon-separated list of directories that contain manual page directory subtrees. For example, if path is /usr/share/man:/usr/local/man, man searches for name in the standard location, and then /usr/local/man. When used with the -f, -k or -K options, the -M option must appear first. Each directory in the path is assumed to contain subdirectories of the form man* or sman* , one for each section. This option overrides the MANPATH environment variable.
Reformats the manual page, but does not display it. This replaces the man - -t name combination.
Specifies sections of the manual for man to search. The directories searched for name are limited to those specified by section. section can be a numerical digit, perhaps followed by one or more letters to match the desired section of the manual, for example, “3lib”. Also, section can be a word, for example, local, new, old, public. section can also be a letter. To specify multiple sections, separate each section with a comma. This option overrides the MANPATH environment variable and the man.cf file. See Search Path below for an explanation of how man conducts its search.
man arranges for the specified manual pages to be troffed to a suitable raster output device (see troff(1)). If both the - and -t flags are given, man updates the troffed versions of each named name (if necessary), but does not display them.
Formats manual pages using macro-package rather than the standard -man macros defined in /usr/share/lib/tmac/an. See Search Path under USAGE for a complete explanation of the default search path order.
The following operand is supported:
The name of a standard utility or a keyword.
The usage of man is described below:
Entries in the reference manuals are organized into sections. A section name consists of a major section name, typically a single digit, optionally followed by a subsection name, typically one or more letters. An unadorned major section name, for example, “9”, does not act as an abbreviation for the subsections of that name, such as “9e”, “9f”, or “9s”. That is, each subsection must be searched separately by man -s. Each section contains descriptions apropos to a particular reference category, with subsections refining these distinctions. See the intro manual pages for an explanation of the classification used in this release.
The following contains a brief description of each manual page section and the information it references:
Section 1 describes, in alphabetical order, commands available with the operating system.
Section 1M describes, in alphabetical order, commands that are used chiefly for system maintenance and administration purposes.
Section 2 describes all of the system calls. Most of these calls have one or more error returns. An error condition is indicated by an otherwise impossible returned value.
Section 3 describes functions found in various libraries, other than those functions that directly invoke UNIX system primitives, which are described in Section 2.
Section 4 outlines the formats of various files. The C structure declarations for the file formats are given where applicable.
Section 5 contains miscellaneous documentation such as character-set tables.
Section 7 describes various special files that refer to specific hardware peripherals and device drivers. STREAMS software drivers, modules and the STREAMS-generic set of system calls are also described.
Section 9E describes the DDI (Device Driver Interface)/DKI (Driver/Kernel Interface), DDI-only, and DKI-only entry-point routines a developer can include in a device driver.
Section 9F describes the kernel functions available for use by device drivers.
Section 9S describes the data structures used by drivers to share information between the driver and the kernel.
Before searching for a given name, man constructs a list of candidate directories and sections. man searches for name in the directories specified by the MANPATH environment variable.
In the absence of MANPATH, man constructs its search path based upon the PATH environment variable, primarily by substituting man for the last component of the PATH element. Special provisions are added to account for unique characteristics of directories such as /sbin, /usr/ucb, /usr/xpg4/bin, and others. If the file argument contains a / character, the dirname portion of the argument is used in place of PATH elements to construct the search path.
Within the manual page directories, man confines its search to the sections specified in the following order:
sections specified on the command line with the -s option
sections embedded in the MANPATH environment variable
sections specified in the man.cf file for each directory specified in the MANPATH environment variable
If none of the above exist, man searches each directory in the manual page path, and displays the first matching manual page found.
The man.cf file has the following format:
Lines beginning with `#' and blank lines are considered comments, and are ignored. Each directory specified in MANPATH can contain a manual page configuration file, specifying the default search order for that directory.
Manual pages are marked up in nroff(1) or sgml(5). nroff manual pages are processed by nroff(1) or troff(1) with the -man macro package. Please refer to man(5) for information on macro usage. SGML—tagged manual pages are processed by an SGML parser and passed to the formatter.
When formatting an nroff manual page, man examines the first line to determine whether it requires special processing. If the first line is a string of the form:
where X is separated from the `"' by a single SPACE and consists of any combination of characters in the following list, man pipes its input to troff(1) or nroff(1) through the corresponding preprocessors.
If the first line of the nroff manual page is a reference to another manual page entry fitting the pattern:
man processes the indicated file in place of the current one. The reference must be expressed as a path name relative to the root of the manual page directory subtree.
Manual pages are identified as being marked up in SGML by the presence of the string <!DOCTYPE. If the file also contains the string SHADOW_PAGE, the file refers to another manual page for the content. The reference is made with a file entity reference to the manual page that contains the text. This is similar to the .so mechanism used in the nroff formatted manual pages.
See environ(5) for descriptions of the following environment variables that affect the execution of man: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
A colon-separated list of directories; each directory can be followed by a comma-separated list of sections. If set, its value overrides /usr/share/man as the default directory search path, and the man.cf file as the default section search path. The -M and -s flags, in turn, override these values.)
A program to use for interactively delivering man's output to the screen. If not set, `more -s' is used. See more(1).
The name of the program to use to display troffed manual pages.
The name of the formatter to use when the -t flag is given. If not set, troff(1) is used.
示例 1 Creating a Text Version of a Manual Page
The following example creates the pipe(2) manual page in ascii text:
% man pipe.2 | col -x -b > pipe.text
This is an alternative to using man -t, which sends the manual page to the default printer, if the user wants a text file version of the manual page.
示例 2 Getting a List of Manual Pages that Match One or More Terms
The following example gets a list of manual pages that match for the term zfs or create:
% man -K zfs create
示例 3 Getting a List of Manual Pages that Match One or More Phrases
The following example gets a list of manual pages that match for the quote-enclosed phrases, “zfs create” or “storage pool”.
% man -K 'zfs create' "storage pool"
示例 4 Getting a List of Manual Pages that Match Terms or Phrases in a Section
The following example gets a list of manual pages that have the term zfs in the SEE ALSO section:
% man -K see also: zfs
The following example gets a list of manual pages that have the phrase “zfs create” in the Examples section:
% man -K examples: "zfs create"
The following exit values are returned:
An error occurred.
Root of the standard manual page directory subtree
Unformatted nroff manual entries
Table of Contents and keyword database.
Generated files include:
Unformatted SGML manual entries
nroffed manual entries
troffed manual entries
Standard –man macro package
SGML document type definition files
SGML style sheet and entity definitions directories
Standard definitions for eqn and neqn
Default search order by section
See attributes(5) for descriptions of the following attributes:
The windex database file is no longer used. The windex database file has replaced with the new index files.
The man command is CSI-capable. However, some utilities invoked by the man command, namely, troff, eqn, neqn, refer, tbl, and vgrind, are not verified to be CSI-capable. Because of this, the man command with the -t option can not handle non-EUC data. Also, using the man command to display manual pages that require special processing through eqn, neqn, refer, tbl, or vgrind can not be CSI-capable.
The manual is supposed to be reproducible either on a phototypesetter or on an ASCII terminal. However, on a terminal some information (indicated by font changes, for instance) is lost.
Some dumb terminals cannot process the vertical motions produced by the e (see eqn(1)) preprocessing flag. To prevent garbled output on these terminals, when you use e, also use t, to invoke col(1) implicitly. This workaround has the disadvantage of eliminating superscripts and subscripts, even on those terminals that can display them. Control-q clears a terminal that gets confused by eqn(1) output.