- Unix Commands Reference
- Unix Commands - Home
man Command in Linux
NAME
man it is the interface used to view the system's reference manuals.
SYNOPSIS
man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m system[,...]] [-M path] [-S list] [-e extension] [-i|-I] [--regex|--wildcard] [--names-only] [-a] [-u] [--no-subpages] [-P pager] [-r prompt] [-7] [-E encoding] [--no-hyphenation] [--no-justification] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] [[section] page ...] ... man -k [apropos options] regexp ... man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ... man -f [whatis options] page man -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-P pager] [-r prompt] [-7] [-E encoding] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] file ... man -w|-W [-C file] [-d] [-D] page ... man -c [-C file] [-d] [-D] page ... man [-hV]
DESCRIPTION
man is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of these arguments is then found and displayed. A section, if provided, will direct man to look only in that section of the manual. The default action is to search in all of the available sections, following a pre-defined order and to show only the first page found, even if page exists in several sections.
Options
Tag | Description |
---|---|
-C file, --config-file=file | Use this user configuration file rather than the default of ~/.manpath |
-d, --debug | Print debugging information. |
-D, --default | This option is normally issued as the very first option and resets man's behaviour to its default. Its use is to reset those options that may have been set in $MANOPT. Any options that follow -D will have their usual effect. |
--warnings[=warnings] | Enable warnings from groff. This may be used to perform sanity checks on the source text of manual pages. warnings is a comma-separated list of warning names; if it is not supplied, the default is "mac". |
-f, --whatis | Equivalent to whatis. Display a short description from the manual page. |
-k, --apropos | Search the short manual page descriptions for keywords and display any matches. |
-K, --global-apropos | Search for text in all manual pages. This is a brute-force search, and is likely to take some time; if you can, you should specify a section to reduce the number of pages that need to be searched. Search terms may be simple strings (the default), or regular expressions if the --regex option is used. |
-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 correct format. 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 exact match. |
-w, --where, --location | Don't actually display the manual pages, but do print the location(s) of the source nroff files that would be formatted. |
-W, --where-cat, --location-cat | Don't actually display the manual pages, but do print the location(s) of the cat files that would be displayed. If -w and -W are both specified, print both separated by a space. |
-c, --catman | This option is not for general use and should only be used by the catman program. |
-R encoding, --recode=encoding | Instead of formatting the manual page in the usual way, output its source converted to the specified encoding. If you already know the encoding of the source file, you can also use manconv(1) directly. However, this option allows you to convert several manual pages to a single encoding without having to explicitly state the encoding of each, provided that they were already installed in a structure similar to a manual page hierarchy. |
-L locale, --locale=locale | man will normally determine your current locale by a call to the C function setlocale which interrogates various environment variables, possibly including $LC_MESSAGES and $LANG. To temporarily override the determined value, use this option to supply a locale string directly to man. Note that it will not take effect until the search for pages actually begins. Output such as the help message will always be displayed in the initially determined locale. |
-m system[,...], --systems=system[,...] | 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 -m NewOS. |
-M path, --manpath=path | Specify an alternate manpath to use. By default, man uses manpath derived code to determine the path to search. This option overrides the $MANPATH environment variable and causes option -m 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 |
-S list, -s list, --sections=list | List is a colon- or comma-separated list of `order specific' manual sections to search. This option overrides the $MANSECT environment variable. |
-e sub-extension, --extension=sub-extension | Some systems incorporate large packages of manual pages, such as those that accompany the Tcl package, into the main manual page hierarchy. To get around the problem of having two manual pages with the same name such as exit, the Tcl pages were usually all assigned to section l. |
-i, --ignore-case | Ignore case when searching for manual pages. This is the default. |
-I, --match-case | Search for manual pages case-sensitively. |
--regex | Show all pages with any part of either their names or their descriptions matching each page argument as a regular expression, as with apropos. Since there is usually no reasonable way to pick a "best" page when searching for a regular expression, this option implies -a. |
--wildcard | Show all pages with any part of either their names or their descriptions matching each page argument using shell-style wildcards, as with apropos(1) --wildcard. The page argument must match the entire name or description, or match on word boundaries in the description. Since there is usually no reasonable way to pick a "best" page when searching for a wildcard, this option implies -a. |
--names-only | If the --regex or --wildcard option is used, match only page names, not page descriptions, as with whatis. Otherwise, no effect. |
-a, --all | By default, man will exit after displaying the most suitable manual page it finds. Using this option forces man to display all the manual pages with names that match the search criteria. |
-u, --update | This option causes man 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 man is installed with the setuid bit set. |
--no-subpages | By default, man will try to interpret pairs of manual page names given on the command line as equivalent to a single manual page name containing a hyphen or an underscore. |
-P pager, --pager=pager | Specify which output pager to use. By default, man uses pager -s. This option overrides the $MANPAGER environment variable, which in turn overrides the $PAGER environment variable. It is not used in conjunction with -f or -k. The value may be a simple command name or a command with arguments, and may use shell quoting (backslashes, single quotes, or double quotes). |
-r prompt, --prompt=prompt | If a recent version of less is used as the pager, man will attempt to set its prompt and some sensible options. |
-7, --ascii | When viewing a pure ascii(7) manual page on a 7 bit terminal or terminal emulator, some characters may not display correctly when using the latin1(7) device description with GNU nroff. This option allows pure ascii manual pages to be displayed in ascii with the latin1 device. It will not translate any latin1 text. |
-E encoding, --encoding=encoding | Generate output for a character encoding other than the default. For backward compatibility, encoding may be an nroff device such as ascii, latin1, or utf8 as well as a true character encoding such as UTF-8. |
--no-hyphenation, --nh | Normally, nroff will automatically hyphenate text at line breaks even in words that do not contain hyphens, if it is necessary to do so to lay out words on a line without excessive spacing. This option disables automatic hyphenation, so words will only be hyphenated if they already contain hyphens. |
--no-justification, --nj | Normally, nroff will automatically justify text to both margins. This option disables full justification, leaving justified only to the left margin, sometimes called "ragged-right" text. If you are writing a manual page and simply want to prevent nroff from justifying certain paragraphs, do not use this option, but consult the nroff documentation instead; for instance, you can use the ".na", ".nf", ".fi", and ".ad" requests to temporarily disable adjusting and filling. |
-p string, --preprocessor=string | Specify the sequence of preprocessors to run before nroff or troff/groff. Not all installations will have a full set of preprocessors. Some of the preprocessors and the letters used to designate them are: eqn (e), grap (g), pic (p), tbl (t), vgrind (v), refer (r). This option overrides the $MANROFFSEQ environment variable. zsoelim is always run as the very first preprocessor. |
-t, --troff | Use groff -mandoc to format the manual page to stdout. This option is not required in conjunction with -H, -T, or -Z. |
-T[device], --troff-device[=device] | This option is used to change groff (or possibly troff's) output to be suitable for a device other than the default. |
-H[browser], --html[=browser] | This option will cause groff to produce HTML output, and will display that output in a web browser. The choice of browser is determined by the optional browser argument if one is provided, by the $BROWSER environment variable, or by a compile-time default if that is unset (usually lynx). This option implies -t, and will only work with GNU troff. |
-X[dpi], --gxditview[=dpi] | This option displays the output of groff in a graphical window using the gxditview program. The dpi (dots per inch) may be 75, 75-12, 100, or 100-12, defaulting to 75; the -12 variants use a 12-point base font. This option implies -T with the X75, X75-12, X100, or X100-12 device respectively. |
-Z, --ditroff | groff will run troff and then use an appropriate post-processor to produce output suitable for the chosen device. If groff -mandoc is groff, this option is passed to groff and will suppress the use of a post-processor. It implies -t. |
-h, --help | Print a help message and exit. |
-V, --version | Display version information. |
EXAMPLES
Example-1:
To Display the manual page for the item (program) ls :
$ man ls
output:
it will display man page of ls command
To Display, in succession, all of the available intro manual pages contained within the manual. It is possible to quit between successive displays or skip any of them:
$ man -a intro
output:
# man -a intro
--Man-- next: intro(8) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
--Man-- next: intro(3) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
--Man-- next: intro(2) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
--Man-- next: intro(5) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
--Man-- next: intro(4) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
--Man-- next: intro(6) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
--Man-- next: intro(7) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
to get to next page press q to quit.
Example-3:
Format the manual page referenced by `alias', usually a shell manual page, into the default troff or groff format and pipe it to the printer named ps :
$ man -t alias | lpr -Pps
output:
command content will be sent to printer.
Example-4:
Search the short descriptions and manual page names for the keyword printf as regular expression. Print out any matches. Equivalent to apropos -r printf. :output:
# man -k printf
printf (1) - format and print data
Example-5:
To Lookup the manual pages referenced by mkdir and print out the short descriptions of any found. Equivalent to whatis -r mkdir.
$ man -f mkdir
output:
# man -f mkdir
mkdir (1) - make directories
Example-6:
To invoke the subcommands themselves. For example :
$ man -aw git diff
output:
/usr/share/man/man1/git-diff.1.gz To disable this behaviour, use the --no-subpages option. $ man -aw --no-subpages git diff /usr/share/man/man1/git.1.gz /usr/share/man/man3/Git.3pm.gz /usr/share/man/man1/diff.1.gz