User Tools

Site Tools


pages:man:man

man

useful stuff:

Finding man Pages by Topic

What man pages are available that document file compression?

man -k compress
apropos compress

will bring up a long list of programs and references, including gzip, bzip2 and xz, and a number of file utilities that work with compressed files, such as zless, zgrep, bzcat, and xzdiff.

man Pages by Section

From the command line, bring up the man page for the printf library function. In which manual page section are library functions found?

man 3 printf
man printf will bring up the command-line utility (section 1) of the same name.

all man pages from all sections:

man -a printf

SUPER! =)

display description for Manpages

man -f passwd

passwd (5)           - password file
sslpasswd (1ssl)     - compute password hashes
passwd (1)           - update user's authentication tokens

man from LFS101

The man program searches, formats, and displays the information contained in the man pages. Because many topics have a lot of information, output is piped through a pager program such as less to be viewed one page at a time; at the same time, the information is formatted for a good visual display.

When no options are given, by default one sees only the dedicated page specifically about the topic. You can broaden this to view all pages containing a string in their name by using the -f option. You can also view all pages that discuss a specified subject (even if the specified subject is not present in the name) by using the –k option.

  • man –f generates the same result as typing whatis.
  • man –k generates the same result as typing apropos.

The man pages are divided into nine numbered chapters (1 through 9). Sometimes, a letter is appended to the chapter number to identify a specific topic. For example, many pages describing part of the X Window API are in chapter 3X.

The chapter number can be used to force man to display the page from a particular chapter; it is common to have multiple pages across multiple chapters with the same name, especially for names of library functions or system calls.

With the -a parameter, man will display all pages with the given name in all chapters, one after the other.

man 3 printf 
man -a printf

man --help

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.

The man Command

The man command is used to format and display the man pages.

The man pages are a user manual that is by default built into most Linux distributions (i.e., versions) and most other Unix-like operating systems during installation. They provide extensive documentation about commands and other aspects of the system, including configuration files, system calls, library routines and the kernel (i.e., the core of the operating system). A configuration file is a type of simple database that contains data that tells a program or operating system how to behave. A system call is a request made via a software interrupt (i.e., a signal to the kernel initiated by software) by an active process for a service performed by the kernel. A library routine is a subprogram that is used by programmers to simplify the development of software.

The man pages are tailored to the particular operating system, and version thereof, on which they are installed. This is beneficial because there can be slight differences in commands and other items according to the particular system.

The descriptions are rather terse, and they can seem somewhat cryptic to new users. However, users typically find them to be increasingly useful as they become more familiar with them and gain experience in the use of Unix-like operating systems.

The man command itself is extremely easy to use. Its basic syntax is

man [option(s)] keyword(s)

man is most commonly used without any options and with only one keyword. The keyword is the exact name of the command or other item for which information is desired. For example, the following provides information about the ls command (which is used to list the contents of any specified directory):

man ls

As another example, the following displays the man page about the man pages:

man man

man automatically sends its output through a pager, usually the program less. A pager is a program that causes the output of any program to be displayed one screenful at a time, rather than having a large amount of text scroll down the screen at high (and generally unreadable) speed.

less writes a colon at the bottom of the screen to indicate the end of the on-screen page. The user can move to the next page by pushing the space bar and can return to the previous page by pressing the b key. Pressing the q exits the man pages and returns the user to the shell program.

Each man page is a self-contained article that is divided into a number of sections, the headers for which are labeled with upper case letters. The sections for commands are typically something like NAME, SYNOPSIS, DESCRIPTION, OPTIONS, AUTHOR, BUGS, COPYRIGHT, HISTORY and SEE ALSO, although there may be some differences according to the particular command. Some of these might be broken down into subsections, particularly OPTIONS in the case of a command that has numerous options.

Also, the man pages as a whole are organized into sections, each containing pages about a specific category of topics as shown below. The section to which an article belongs is indicted in parenthesis in the top line, before the NAME header.

1. executable programs or shell commands
2. system calls
3. library routines
4. special files (i.e., devices in the /dev directory)
5. file formats
6. games
7. macro packages
8. system administration commands
9. kernel routines
10. Tcl/Tk (a programming language)

Some topic names will have multiple articles, depending on context. For instance, there are two articles for mount, one corresponding to its use as a command in system management (i.e., to logically attach partition or other devices to the main filesystem) and the other for use in the C programming language. Generally, the most commonly used topic is displayed by default, and there are references to any other topics with the same name in the SEE ALSO section at the bottom of the final on-screen page.

The syntax to specify an article from a particular section is:

man section_number keyword
Thus, for example, the following would display the article about mount from Section 2 instead of from the default Section 8:
man 2 mount
The -w and -W options tell man to not actually display the man pages, but to provide the location(s) of the file(s) that would be formatted or displayed. If no arguments (i.e., input files) are provided, a list of directories that is searched by man for man pages is returned.

The -f option produces the same output as the whatis command. whatis provides very brief descriptions of commands from a database that is automatically created from the first line of the NAME section of each relevant man page. The -h option displays a terse summary of man's syntax and options.

A simpler version of a man page, i.e., without backspaces and underscores, can be obtained by piping (i.e., transferring) its output to the col command used with its -b option. Thus, for example, the following would write such a version of the man page about the pstree command (which shows the processes currently on the system in a tree diagram) to a text file called pstree.txt (and create a file with this name if it did not already exist):

man pstree | col -b > pstree.txt
Unix-like operating systems often also have an additional built-in manual referred to as the Info documents, the content of which is largely identical to that of the man pages. These documents can be accessed with the info command.

Although the man pages are usually viewed in a console (i.e., all-text mode) or terminal window (i.e., a text-mode window in a GUI), they can also be viewed in the Konquerer web browser, which is included with many Linux distributions. Some users might find that this provides enhanced usability, including the ability to scroll up and down an entire article regardless of its length and greater ease of changing font sizes. Any man article can be displayed in Konquerer by typing man followed by a colon and the name of the program.

Thus, for example, the following would tell Konquerer to display the man page for pstree:

man:pstree
The Linux Information Project (LINFO) is providing an on-line alternative to the man pages with its series of articles about commonly used commands and other aspects of Linux. One major difference is that the LINFO articles are designed to be useful to users of all levels, including absolute beginners. In particular, emphasis is placed on the most useful options for commands and specific examples are often provided. An index, along with brief descriptions, of such articles about commands that have been provided to date is Index of Linux Commands.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
pages/man/man.txt · Last modified: 2021/12/01 18:09 by mischerh