LINUX CLASSES - BASICS
The man Command
man - format and display the on-line manual pages
manpath - determine user's search path for man pages
SYNOPSIS
man [-acdfFhkKtwW] [-m system] [-p string] [-C con
fig_file] [-M path] [-P pager] [-S section_list] [section]
name ...
DESCRIPTION
man formats and displays the on-line manual pages. This
version knows about the MANPATH and (MAN)PAGER environment
variables, so you can have your own set(s) of personal man
pages and choose whatever program you like to display the
formatted pages. If section is specified, man only looks
in that section of the manual. You may also specify the
order to search the sections for entries and which prepro
cessors to run on the source files via command line
options or environment variables. If name contains a /
then it is first tried as a filename, so that you can do
man ./foo.5 or even man /cd/foo/bar.1.gz.
OPTIONS
-C config_file
Specify the man.conf file to use; the default is
/etc/man.config. (See man.conf(5).)
-M path
Specify the list of directories to search for man
pages. If no such option is given, the environment
variable MANPATH is used. If no such environment
variable is found, the default list is found by
consulting /etc/man.config. An empty substring of
MANPATH denotes the default list.
-P pager
Specify which pager to use. This option overrides
the MANPAGER environment variable, which in turn
overrides the PAGER variable. By default, man uses
/usr/bin/less-is.
-S section_list
List is a colon separated list of manual sections
to search. This option overrides the MANSECT envi
ronment variable.
-a By default, man will exit after displaying the
first manual page it finds. Using this option
forces man to display all the manual pages that
match name, not just the first.
-c Reformat the source man page, even when an up-to-
date cat page exists. This can be meaningful if
page is corrupted.
-d Don't actually display the man pages, but do print
gobs of debugging information.
-D Both display and print debugging info.
-f Equivalent to whatis.
-F or --preformat
Format only - do not display.
-h Print a one-line help message and exit.
-k Equivalent to apropos.
-K Search for the specified string in *all* man pages.
Warning: this is probably very slow! It helps to
specify a section. (Just to give a rough idea, on
my machine this takes about a minute per 500 man
pages.)
-m system
Specify an alternate set of man pages to search
based on the system name given.
-p string
Specify the sequence of preprocessors to run before
nroff or troff. Not all installations will have a
full set of preprocessors. Some of the preproces
sors 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.
-t Use /usr/bin/groff -Tps -mandoc to format the man
ual page, passing the output to stdout. The output
from /usr/bin/groff -Tps -mandoc may need to be
passed through some filter or another before being
printed.
-w or --path
Don't actually display the man pages, but do print
the location(s) of the files that would be format
ted or displayed. If no argument is given: display
(on stdout) the list of directories that is
searched by man for man pages. If manpath is a link
to man, then "manpath" is equivalent to "man
--path".
-W Like -w, but print file names one per line, without
additional information. This is useful in shell
Man will try to save the formatted man pages, in order to
save formatting time the next time these pages are needed.
Traditionally, formatted versions of pages in DIR/manX are
saved in DIR/catX, but other mappings from man dir to cat
dir can be specified in /etc/man.config. No cat pages are
saved when the required cat directory does not exist.
It is possible to make man suid to a user man. Then, if a
cat directory has owner man and mode 0755 (only writable
by man), and the cat files have owner man and mode 0644 or
0444 (only writable by man, or not writable at all), no
ordinary user can change the cat pages or put other files
in the cat directory. If man is not made suid, then a cat
directory should have mode 0777 if all users should be
able to leave cat pages there.
The option -c forces reformatting a page, even if a recent
cat page exists.
ENVIRONMENT
MANPATH
If MANPATH is set, its value is used as the path to
search for manual pages.
MANPL If MANPL is set, its value is used as the display
page length. Otherwise, the entire man page will
occupy one (long) page.
MANROFFSEQ
If MANROFFSEQ is set, its value is used to deter
mine the set of preprocessors run before running
nroff or troff. By default, pages are passed
through the table preprocessor before nroff.
MANSECT
If MANSECT is set, its value is used to determine
which manual sections to search.
MANWIDTH
If MANWIDTH is set, its value is used as the width
manpages should be displayed. Otherwise the pages
may be displayed over the whole width of your
screen.
MANPAGER
If MANPAGER is set, its value is used as the name
of the program to use to display the man page. If
not, then PAGER is used. If that has no value
either, /usr/bin/less -is is used.
Thus, the command `LANG=dk man 1 foo' will cause
man to look for the foo man page in
.../dk/man1/foo.1, and if it cannot find such a
file, then in .../man1/foo.1, where ... is a direc
tory on the search path.
NLSPATH, LC_MESSAGES, LANG
The environment variables NLSPATH and LC_MESSAGES
(or LANG when the latter does not exist) play a
role in locating the message catalog. (But the
English messages are compiled in, and for English
no catalog is required.) Note that programs like
col(1) called by man also use e.g. LC_CTYPE.
PATH PATH is used in the construction of the default
search path for man pages.
SYSTEM SYSTEM is used to get the default alternate system
name (for use with the -m option).
SEE ALSO
apropos(1), whatis(1), less(1), groff(1).
BUGS
The -t option only works if a troff-like program is
installed.
If you see blinking \255 or <AD> instead of hyphens, put
`LESSCHARSET=latin1' in your environment.
TIPS
If you add the line
(global-set-key [(f1)] (lambda () (interactive) (manual-
entry (current-word))))
to your .emacs file, then hitting F1 will give you the man
page for the library call at the current cursor position.
To get a plain text version of a man page, without
backspaces and underscores, try
# man foo | col -b > foo.mantxt
Comments - most recent first (Please feel free to answer questions posted by others!)
BALRAJ SINGH SINGH RATHOR ( 26 Feb 2012, 20:53)
I am to learn linux. How should I start.
Jonacani Bulai ( 17 Nov 2011, 15:34)
I am new to this and I am indid need a help.
Bob Rankin ( 26 Jan 2011, 09:49)
@Sharron - type q and press Enter.
Sharron ( 24 Jan 2011, 12:37)
Help I can't get out of the manual... :-) I'm getting a : prompt?
Avinash Patil ( 25 Aug 2010, 09:28)
Thankssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
sssssssss
I welcome your comments. However... I am puzzled by many people
who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn
all you can, ask questions if you like. But don't ask me to send what you already have. :-)
NO SPAM! If you post garbage, it will be deleted, and you will be banned.
|
Copyright ©
by Bob Rankin
- Privacy Policy
All rights reserved - Redistribution is allowed only with permission.