Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Thursday, March 14, 2019
 
 

man(1)

Name

man - find and display reference manual pages

Synopsis

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...

Description

The man command displays information from the reference manuals. It displays complete manual pages that you select by name, or 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.

Source Format

Reference Manual pages are marked up with nroff. 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. For more information, see the groff(1) man page.

Location of Manual Pages

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. 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 the host on which they reside.

If there are preformatted, up-to-date versions in the corresponding cat* or fmt* directories, the man command simply displays or prints those versions. If the preformatted version of interest is out of date or missing, the man command reformats it prior to display and stores the preformatted version if cat* or fmt* is writable. The index files are not updated. For more information, see the catman(8) man page. If directories for the preformatted versions are not provided, the man command reformats a page whenever it is requested. The man command 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, the man command pipes its output through cat(1). Otherwise, the man command pipes its output through less(1) to handle paging and underlining on the screen.

Query Strings

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, query expansion, stemming, and section matching. For more information regarding how to generate the index files, see the catman(8) man page.

A term is a sequence of characters from a valid character set that contains all alpha characters, digits and underline, {a-z,A-Z,_}. It is a useful semantic unit for full-text processing. But, in all valid terms, stop words or terms will not be indexed and searched.

Stop words are some of the most common, short function terms, such as, "the", "is", "at", "which", and so on. In some cases, stop terms can cause problems, especially when the searched query contains them. For example, "the ZFS system" and "take that". Therefore, whenever index building or query search is carried out, the stop words are removed to improve the performance of the man command.

A phrase is composed of multiple terms that are concatenated together by non-indexed characters, usually a space character. In a terminal, when a user searches for a phrase, it is usually encompassed within double quote.

Query expansion is a useful technique in full-text domain. It is used to refactor the original user input query string and reweight added query terms, avoiding the empty search result to improve man full-text search performance.

Term query expansion is aimed to help users automatically complete incomplete input terms and give the corrected form.

Acronym query expansion is used to help users complete acronym expansion when the user query contains some acronyms. It will automatically append the corresponding full name string to the user query.

Stemming for English, for example, identifies the string, cats, catlike, catty, and so on, based on the root word, cat. The strings, stemmer, stemming, and stemmed can be identified based on the root word, stem. A stemming algorithm reduces the words, fishing, fished, fish, and fisher to the root word, fish.

Section matching allows users to specify a section name in query string to limit the searched scope in each manual page. The section name refers to the section title in each manual page to help define a manual page layout or structure, such as NAME, SYNOPSIS, DESCRIPTION, and so on.

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 on. Users can specify the scope of search into a section as details described in the –K option.

Options

The following options are supported:

–a

Shows all manual pages matching name within the MANPATH search path. Manual pages are displayed in the order found.

–d

Debugs. Displays what a section-specifier evaluates to, the method used for searching, and the paths searched by the man command.

–f file ...

The man command attempts to locate manual pages related to any of the given files. It prints summaries containing the resulting basename or names. The same action is performed by the whatis command.

This option uses index files. For details about how index files are generated, see the catman(8) man page.

–F

Forces the man command 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 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.

–k query ...

Searches for the specified query from the index files and prints out summaries. Only the NAME section is searched. The same action is performed by the apropos command.

For information about how the index files are generated, see the –K option.

–K query ...

Searches for the specified query from the index files and prints out summaries. All of the sections are searched by default.

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 names for the users.

The index files in /usr/share/man and /usr/gnu/share/man used by –f, –k, and –K are automatically generated when manual 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. They may also be generated by running svcadm restart application/man-index manually, or by running the catman command with the –w option.

–l

Lists all manual pages within the search path, found matching the specified name.

–M 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, the man command searches for name in the standard location, and then in the /usr/local/man directory. 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.

–r

Reformats the manual page, but does not display it. This option replaces the man –t name combination.

–s section ...

Specifies sections of the manual page for the man command 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”. section can also be a word, for example, local, new, old, public, and so on, or 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. For an explanation on how the man command conducts its search, see the Search Path below.

A major section name, for example, "9", can act as an abbreviation for the subsections of that name, such as "9e", "9f", or "9s". For more details, see the Manual Page Sections below.

Some section names were changed in Oracle Solaris 11.4, and the subsections of these sections were changed too.

Solaris 2 through 11.3	  	Solaris 11.4
----------------------		  ------------
1m                      ->        8
4                       ->        5
5                       ->        7
7                       ->        4

If no manual page was found in the specified section name, and the section name used in Solaris 2 through 11 was specified, the man command further searches in the section name used in Solaris 11.4. For example, the manual page, ip(4P) can be found by any of the following ways:

man -s 4p ip
man -s 4 ip
man -s 7p ip
man -s 7 ip
–t

The man command outputs postscript to stdout. If both the and –t flags are given, the man command updates the troffed versions of each named name (if necessary), but does not display them.

–T macro-package

Formats manual pages using macro-package rather than the standard –mandoc macros. If it starts with the '–m' option, the macro package is specified as an option in groff. For more information about these options, see the groff(1) man pages. You can continue to add the '–r' option to specify the macros's option. If it starts with '/', it signifies that a macro package is directly specified. A macro under /usr/share/lib/tmac can be specified by this. See Example 5.

Operands

The following operand is supported:

name

The name of a standard utility or a keyword.

Usage

The usage of man is described below:

Manual Page Sections

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", acts as an abbreviation for the subsections of that name, such as "9e", "9f", or "9s". That is, if 'man -s 9 name' is specified, and the name is not found in subsection "9", then the "9e", "9f" and "9s" subsections are searched. Each section contains descriptions concerning a particular reference category, with subsections refining these distinctions. For an explanation of the classifications used in this release, see the intro man pages.

The following list contains a brief description of each manual page section and the information it references:

  • Section 1 describes commands available with the operating system.

  • 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 2D describes DTrace Providers.

  • 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 3* describes collections of related libraries.

  • Section 4 describes various device and network interfaces available on the system.

  • Section 4D describes special files that refer to specific hardware peripherals and device drivers. STREAMS device drivers are also described.

  • Section 4FS describes the programmatic interface for several file systems supported by Oracle Solaris.

  • Section 4I describes ioctl requests which apply to a class of drivers or subsystems.

  • Section 4M describes STREAMS modules.

  • Section 4P describes various network protocols available in Oracle Solaris.

  • Section 5 outlines the formats of various files. The C structure declarations for the file formats are given where applicable.

  • Section 6 describes games and screensavers.

  • Section 7 contains miscellaneous documentation such as character-set tables.

  • Section 8 describes commands that are primarily used for system maintenance and administration purposes.

  • Section 8S describes SMF services.

  • Section 9 describes reference information needed to write device drivers for the Oracle Solaris operating environment.

  • 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 9P describes driver properties.

  • Section 9S describes the data structures used by drivers to share information between the driver and the kernel.

Search Path

Before searching for a given name, the man command constructs a list of candidate directories and sections. The man command searches for name in the directories specified by the MANPATH environment variable.

In the absence of MANPATH, the man command constructs its search path based on the PATH environment variable, primarily by substituting the man command for the last component of the PATH element. Special provisions are added to the account for unique characteristics of directories such as /sbin, /usr/xpg4/bin, and others. If the file argument is an absolute path, the dirname portion of the argument is used in place of PATH elements to construct the search path.

Within the manual page directories, the man command 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, the man command searches each directory in the manual page path, and displays the first matching manual page found.

The man.cf file has the following format:

MANSECTS=section[,section]... 

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.

Hierarchical Manual Page Name

The man command supports hierarchical manual page name which contains one or more slashes. <name> can be abbreviated by specifying the trailing portion of the manual page name, like when specifying FMRI to commands for smf(7).

For instance, system/name-service/switch.8s would show the manual page from /usr/share/man/man8s/system/name-service/switch.8s. The following examples show same results.

man system/name-service/switch
man name-service/switch
man -s 8s switch
man -s 8 switch
man switch.8s

Formatting Manual Pages

Manual pages are marked up in the groff command. nroff manual pages are processed by groff with the –mandoc macro package. For information about macro usage, see the groff(1) man page.

Preprocessing nroff Manual Pages

When formatting an nroff manual page, the man command examines the first line to determine whether it requires special processing. If the first line is a string of the form:

'\" X

where X is separated from the `"' by a single SPACE, and consists of any combination of characters from the following list. The man command then pipes its input to groff(1) through the corresponding preprocessors.

e

geqn (1)

r

grefer (1)

t

gtbl(1)

v

vgrind(1)

Referring to Other nroff Manual Pages

If the first line of the nroff manual page is a reference to another manual page entry fitting the patterns:

.so man*/sourcefile
.so sourcefile

Then, the man command 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 when a shadow file is in different subdirectories with its reference, just like the first pattern. If they are in the same section subdirectory(man*), the reference can be expressed as a filename, like the second pattern.

When the second or any subsequent line starts with .so, the man command ignores it. Then, the related roff processes the request in the usual manner.

Environment Variables

For information about the LANG_LC_ALL_CTYPE, LC_MESSAGES, and NLSPATH environment variables that affect the execution of the man command, see the environ(7) man page.

MANPATH

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.

PAGER

A program to use for interactively delivering the man command's output to the screen. If not set, `less -ins' is used.

TCAT

The name of the program used to display troffed manual pages.

TROFF

The name of the formatter used when the –t flag is specified.

Examples

Example 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 method is an alternative using the man –t command, which sends the manual page to the default printer, if the user wants a text file version of the manual page.

Example 2 Getting a List of Manual Pages that Match One or More Terms

The following example gets a list of manual pages that match either the term zfs or the term create:

% man -K zfs create
Example 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"
Example 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 has 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"
Example 5 Changing the Default Macro Package

The following example sets the line width to 67 columns and delivers the output in multiple pages instead of single long page. This action provides the look and feel that is similar to the output generated with the man(7) macro.

% man -T '-mandoc -rLL=67n -rcR=0' zfs

The following example uses the actual man(7) macro instead of the default mandoc macro.

% man -T /usr/share/lib/tmac/an zfs

Exit Status

The following exit values are returned:

0

Successful completion.

>0

An error occurred.

Files

/usr/share/man

Root of the standard manual page directory subtree

/usr/share/man/man?/*

Unformatted nroff manual entries

/usr/share/man/man_index/*

Table of Contents and keyword database.

Generated files include:

  • /usr/share/man/man-index/term.idx

  • /usr/share/man/man-index/term.dic

  • /usr/share/man/man-index/term.req

  • /usr/share/man/man-index/term.pos

  • /usr/share/man/man-index/term.doc

  • /usr/share/man/man-index/term.exp

/usr/share/man/cat?/*

nroffed manual entries

/usr/share/man/fmt?/*

troffed manual entries

/usr/share/groff/<version>/tmac/mandoc.tmac

Standard –mandoc macro package used by default

man.cf

Default search order by section

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
text/doctools
CSI
Enabled, see NOTES.
Interface Stability
Committed with exception
Standard

The mapping behavior in –s option, from Oracle Solaris 11 section number, is Uncommitted.

See Also

apropos(1), cat(1), col(1), groff(1), gtbl(1), less(1), vgrind(1), whatis(1), attributes(7), environ(7), standards(7), catman(8)

Notes

The –f, –k, and –K options use the index files which are created by the SMF service by manually using the catman command with the –w option.

The windex database file is no longer used. The windex database file has been replaced with the new index files.

The man command is CSI-capable. However, some utilities invoked by the man command are not verified to be CSI-capable. Due to this, the man command with the –t option cannot handle non ASCII-data. Also, using the man command to display manual pages that require special processing through geqn, grefer, gtbl, or vgrind are not CSI-capable. Default PAGER program, less cannot handle non-UTF-8 multibyte characters. You should set the PAGER to '/usr/xpg4/bin/more' if your environment is non-UTF-8 locale.

Bugs

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.