Linux "man" Command Line Options and Examples
macros to format man pages

man is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function. The man‐ ual page associated with each of these arguments is then found and displayed.


Usage:

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[.section] ...] ...
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 [-?V]






Command Line Options:

-C
Use this user configuration file rather than the default of ~/.manpath.
man -C ...
-d
Print debugging information.
man -d ...
-D
This option is normally issued as the very first option and resets man's behaviour to its default. Its use is to reset thoseoptions that may have been set in $MANOPT. Any options that follow -D will have their usual effect.
man -D ...
--warnings[
Enable warnings from groff. This may be used to perform sanity checks on the source text of manual pages. warnings is acomma-separated list of warning names; if it is not supplied, the default is "mac". See the “Warnings” node in info groff fora list of available warning names.Main modes of operation
man --warnings[ ...
-f
Equivalent to whatis. Display a short description from the manual page, if available. See whatis(1) for details.
man -f ...
-k
Equivalent to apropos. Search the short manual page descriptions for keywords and display any matches. See apropos(1) fordetails.
man -k ...
-K
Search for text in all manual pages. This is a brute-force search, and is likely to take some time; if you can, you shouldspecify 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.Note that this searches the sources of the manual pages, not the rendered text, and so may include false positives due tothings like comments in source files. Searching the rendered text would be much slower.
man -K ...
-l
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 thepage required, before displaying the error message, it attempts to act as if this option was supplied, using the name as afilename and looking for an exact match.
man -l ...
-w
Don't actually display the manual pages, but do print the location(s) of the source nroff files that would be formatted.
man -w ...
-W
Don't actually display the manual pages, but do print the location(s) of the cat files that would be displayed. If -w and -Ware both specified, print both separated by a space.
man -W ...
-c
This option is not for general use and should only be used by the catman program.
man -c ...
-R
Instead of formatting the manual page in the usual way, output its source converted to the specified encoding. If you alreadyknow the encoding of the source file, you can also use manconv(1) directly. However, this option allows you to convert sev‐eral manual pages to a single encoding without having to explicitly state the encoding of each, provided that they werealready installed in a structure similar to a manual page hierarchy.Finding manual pages
man -R ...
-L
man will normally determine your current locale by a call to the C function setlocale(3) which interrogates various environ‐ment variables, possibly including $LC_MESSAGES and $LANG. To temporarily override the determined value, use this option tosupply a locale string directly to man. Note that it will not take effect until the search for pages actually begins. Outputsuch as the help message will always be displayed in the initially determined locale.
man -L ...
-m
If this system has access to other operating system's manual pages, they can be accessed using this option. To search for amanual page from NewOS's manual page collection, use the option -m NewOS.The system specified can be a combination of comma delimited operating system names. To include a search of the native oper‐ating system's manual pages, include the system name man in the argument string. This option will override the $SYSTEM envi‐ronment variable.
man -m ...
-M
Specify an alternate manpath to use. By default, man uses manpath derived code to determine the path to search. This optionoverrides 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-dbmanual (under "The manual page system"). To view manual pages outside such hierarchies, see the -l option.
man -M ...
-S
List is a colon- or comma-separated list of `order specific' manual sections to search. This option overrides the $MANSECTenvironment variable. (The -s spelling is for compatibility with System V.)
man -S ...
-e
Some systems incorporate large packages of manual pages, such as those that accompany the Tcl package, into the main manualpage hierarchy. To get around the problem of having two manual pages with the same name such as exit(3), the Tcl pages wereusually all assigned to section l. As this is unfortunate, it is now possible to put the pages in the correct section, and toassign a specific `extension' to them, in this case, exit(3tcl). Under normal operation, man will display exit(3) in prefer‐ence to exit(3tcl). To negotiate this situation and to avoid having to know which section the page you require resides in, itis now possible to give man a sub-extension string indicating which package the page must belong to. Using the above example,supplying the option -e tcl to man will restrict the search to pages having an extension of *tcl.
man -e ...
-i
Ignore case when searching for manual pages. This is the default.
man -i ...
-I
Search for manual pages case-sensitively.
man -I ...
--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(1). Since there is usually no reasonable way to pick a "best" page when searching for a regular expression,this option implies -a.
man --regex ...
--wildcard
Show all pages with any part of either their names or their descriptions matching each page argument using shell-style wild‐cards, as with apropos(1) --wildcard. The page argument must match the entire name or description, or match on word bound‐aries in the description. Since there is usually no reasonable way to pick a "best" page when searching for a wildcard, thisoption implies -a.
man --wildcard ...
--names-only
If the --regex or --wildcard option is used, match only page names, not page descriptions, as with whatis(1). Otherwise, noeffect.
man --names-only ...
-a
By default, man will exit after displaying the most suitable manual page it finds. Using this option forces man to displayall the manual pages with names that match the search criteria.
man -a ...
-u
This option causes man to perform an `inode level' consistency check on its database caches to ensure that they are an accu‐rate representation of the filesystem. It will only have a useful effect if man is installed with the setuid bit set.
man -u ...
--no-subpages
By default, man will try to interpret pairs of manual page names given on the command line as equivalent to a single manualpage name containing a hyphen or an underscore. This supports the common pattern of programs that implement a number of sub‐commands, allowing them to provide manual pages for each that can be accessed using similar syntax as would be used to invokethe subcommands themselves. For example:$ man -aw git diff/usr/share/man/man1/git-diff.1.gzTo 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.gzControlling formatted output
man --no-subpages ...
-P
Specify which output pager to use. By default, man uses pager, falling back to cat if pager is not found or is not exe‐cutable. 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, ordouble quotes). It may not use pipes to connect multiple commands; if you need that, use a wrapper script, which may take thefile to display either as an argument or on standard input.
man -P ...
-r
If a recent version of less is used as the pager, man will attempt to set its prompt and some sensible options. The defaultprompt looks likeManual page name(sec) line xwhere name denotes the manual page name, sec denotes the section it was found under and x the current line number. This isachieved by using the $LESS environment variable.Supplying -r with a string will override this default. The string may contain the text $MAN_PN which will be expanded to thename of the current manual page and its section name surrounded by `(' and `)'. The string used to produce the default couldbe expressed as\ Manual\ page\ \$MAN_PN\ ?ltline\ %lt?L/%L.:byte\ %bB?s/%s..?\ (END):?pB\ %pB\\%..(press h for help or q to quit)It is broken into three lines here for the sake of readability only. For its meaning see the less(1) manual page. The promptstring is first evaluated by the shell. All double quotes, back-quotes and backslashes in the prompt must be escaped by apreceding backslash. The prompt string may end in an escaped $ which may be followed by further options for less. By defaultman sets the -ix8 options.The $MANLESS environment variable described below may be used to set a default prompt string if none is supplied on the com‐mand line.
man -r ...
-7
When viewing a pure ascii(7) manual page on a 7 bit terminal or terminal emulator, some characters may not display correctlywhen using the latin1(7) device description with GNU nroff. This option allows pure ascii manual pages to be displayed inascii with the latin1 device. It will not translate any latin1 text. The following table shows the translations performed:some parts of it may only be displayed properly when using GNU nroff's latin1(7) device.Description Octal latin1 ascii─────────────────────────────────────────────continuation hyphen 255 ‐ -bullet (middle dot) 267 · oacute accent 264 ´ 'multiplication sign 327 × xIf the latin1 column displays correctly, your terminal may be set up for latin1 characters and this option is not necessary.If the latin1 and ascii columns are identical, you are reading this page using this option or man did not format this pageusing the latin1 device description. If the latin1 column is missing or corrupt, you may need to view manual pages with thisoption.This option is ignored when using options -t, -H, -T, or -Z and may be useless for nroff other than GNU's.
man -7 ...
-E
Generate output for a character encoding other than the default. For backward compatibility, encoding may be an nroff devicesuch as ascii, latin1, or utf8 as well as a true character encoding such as UTF-8.
man -E ...
--no-hyphenation
Normally, nroff will automatically hyphenate text at line breaks even in words that do not contain hyphens, if it is necessaryto do so to lay out words on a line without excessive spacing. This option disables automatic hyphenation, so words will onlybe hyphenated if they already contain hyphens.If you are writing a manual page and simply want to prevent nroff from hyphenating a word at an inappropriate point, do notuse this option, but consult the nroff documentation instead; for instance, you can put "\%" inside a word to indicate that itmay be hyphenated at that point, or put "\%" at the start of a word to prevent it from being hyphenated.
man --no-hyphenation ...
--no-justification
Normally, nroff will automatically justify text to both margins. This option disables full justification, leaving justifiedonly 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 tempo‐rarily disable adjusting and filling.
man --no-justification ...
-p
Specify the sequence of preprocessors to run before nroff or troff/groff. Not all installations will have a full set of pre‐processors. 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 pre‐processor.
man -p ...
-t
Use groff -mandoc to format the manual page to stdout. This option is not required in conjunction with -H, -T, or -Z.
man -t ...
-T[device]
This option is used to change groff (or possibly troff's) output to be suitable for a device other than the default. Itimplies -t. Examples (provided with Groff-1.17) include dvi, latin1, ps, utf8, X75 and X100.
man -T[device] ...
-H[browser]
This option will cause groff to produce HTML output, and will display that output in a web browser. The choice of browser isdetermined by the optional browser argument if one is provided, by the $BROWSER environment variable, or by a compile-timedefault if that is unset (usually lynx). This option implies -t, and will only work with GNU troff.
man -H[browser] ...
-X[dpi]
This option displays the output of groff in a graphical window using the gxditview program. The dpi (dots per inch) may be75, 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.
man -X[dpi] ...
-Z
groff will run troff and then use an appropriate post-processor to produce output suitable for the chosen device. If groff
man -Z ...
-?
Print a help message and exit.
man -? ...
--usage
Print a short usage message and exit.
man --usage ...
-V
Display version information.EXIT STATUS0 Successful program execution.1 Usage, syntax or configuration file error.2 Operational error.3 A child process returned a non-zero exit status.16 At least one of the pages/files/keywords didn't exist or wasn't matched.ENVIRONMENTMANPATHIf $MANPATH is set, its value is used as the path to search for manual pages.MANROFFOPTThe contents of $MANROFFOPT are added to the command line every time man invokes the formatter (nroff, troff, or groff).MANROFFSEQIf $MANROFFSEQ is set, its value is used to determine the set of preprocessors to pass each manual page through. The defaultpreprocessor list is system dependent.MANSECTIf $MANSECT is set, its value is a colon-delimited list of sections and it is used to determine which manual sections tosearch and in what order. The default is "1 n l 8 3 2 3posix 3pm 3perl 3am 5 4 9 6 7", unless overridden by the SECTIONdirective in /etc/manpath.config.MANPAGER, PAGERIf $MANPAGER or $PAGER is set ($MANPAGER is used in preference), its value is used as the name of the program used to displaythe manual page. By default, pager is used, falling back to cat if pager is not found or is not executable.The value may be a simple command name or a command with arguments, and may use shell quoting (backslashes, single quotes, ordouble quotes). It may not use pipes to connect multiple commands; if you need that, use a wrapper script, which may take thefile to display either as an argument or on standard input.MANLESSIf $MANLESS is set, its value will be used as the default prompt string for the less pager, as if it had been passed using the
man -V ...