In this tutorial on Linux man, 4 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.
Our fourth word, or command to memorize is man from the category Help.
man allows you to view online
reference manuals. Two videos ago we used the whatis command to jog our memories about
what a command does, now with man
we'll go a step deeper.
Common Linux man Options
-options
description
--usage
Print usage syntax
-h
Print help screen
If it helps, think of commands as mini programs and most have this
structure. First, type the
command, second the
-option(s) and third the
argument(s).
The man command has over
30 options and its argument is typically a command
you intend to research. Because it pulls text from a database,
man also includes many options for
searching.
Instead of getting bogged down, we'll focus on two simple options.
First is --usage, which provides
possible syntax. Second is -h, that
goes a little deeper.
So why is man an important command?
Well, the documentation is at your fingertips, so to avoid buying
books and to save a few trees, man
provides answers.
And now you know how to do that.
Demonstration
Okay, the best way to embed this in your memory is by typing in your
own terminal window.
Find this on your Mac using a program called Terminal. On Linux use
Terminal or Konsole, and currently Microsoft is adding this
functionality to Windows 10.
Here we go, let's start with man
--usage and look, man, options, and the PAGE... or command we'd
like to look up.
$ man -h
Usage: man [OPTION...] [SECTION] PAGE...
-C, --config-file=FILE use this user configuration file
-d, --debug emit debugging messages
-D, --default reset all options to their default values
--warnings[=WARNINGS] enable warnings from groff
Main modes of operation:
-f, --whatis equivalent to whatis
-k, --apropos equivalent to apropos
-K, --global-apropos search for text in all pages
-l, --local-file interpret PAGE argument(s) as local filename(s)
-w, --where, --path, --location
print physical location of man page(s)
-W, --where-cat, --location-cat
print physical location of cat file(s)
-c, --catman used by catman to reformat out of date cat pages
-R, --recode=ENCODING output source page encoded in ENCODING
Finding manual pages:
-L, --locale=LOCALE define the locale for this particular man search
-m, --systems=SYSTEM use manual pages from other systems
-M, --manpath=PATH set search path for manual pages to PATH
-S, -s, --sections=LIST use colon separated section list
-e, --extension=EXTENSION limit search to extension type EXTENSION
-i, --ignore-case look for pages case-insensitively (default)
-I, --match-case look for pages case-sensitively
--regex show all pages matching regex
--wildcard show all pages matching wildcard
--names-only make --regex and --wildcard match page names only,
not descriptions
-a, --all find all matching manual pages
-u, --update force a cache consistency check
--no-subpages don't try subpages, e.g. 'man foo bar' => 'man
foo-bar'
Controlling formatted output:
-P, --pager=PAGER use program PAGER to display output
-r, --prompt=STRING provide the `less' pager with a prompt
-7, --ascii display ASCII translation of certain latin1 chars
-E, --encoding=ENCODING use selected output encoding
--no-hyphenation, --nh turn off hyphenation
--no-justification, --nj turn off justification
-p, --preprocessor=STRING STRING indicates which preprocessors to run:
e - [n]eqn, p - pic, t - tbl, g - grap, r - refer, v - vgrind
-t, --troff use groff to format pages
-T, --troff-device[=DEVICE] use groff with selected device
-H, --html[=BROWSER] use www-browser or BROWSER to display HTML output
-X, --gxditview[=RESOLUTION] use groff and display through gxditview
(X11):
-X = -TX75, -X100 = -TX100, -X100-12 = -TX100-12
-Z, --ditroff use groff and force it to produce ditroff
-?, --help give this help list
--usage give a short usage message
-V, --version print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Or even better, let's use man to look
up the manual for man. Note, this
opens a text viewer, or pager, which we'll explore in our next video.
And notice the first line is the same line the whatis command pulls from this manual page.
Handy huh? Hit q to quit.
MAN(1) Manual pager utils MAN(1)
NAME
man - an interface to the on-line reference manuals
SYNOPSIS
man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m sys‐
tem[,...]] [-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 [-?V]
DESCRIPTION
...600+ lines trimmed.
A Final Tip
Okay now you know how to use man.
And you know the syntax for commands, options and arguments.
One last tip about the man command.
If page output exceeds the length of your window, use Shift-PgUp and Shift-PgDn.
Okay, thanks for visiting today. I hope this was a fun introduction
to the man command.
Learn More About The Series
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the
categories and a Q&A section, visit: