Man (short for manual) is a command-line utility available on UNIX and UNIX-like operating systems that provides documentation for programs, system calls, libraries, Special files, file formats and games.
Man pages are a form of software documentation that is downloaded locally on the users machines to be used when no internet connection is available.
Command Usage
To read a man page the user can enter the following into their terminal:[1]
man <command_name>
For example, to read the manual for man
command itself:
man man
Manual Sections
The manual normally consists of eight numbered sections. Most Unix-like systems use the numbering scheme used by Research Unix.[2]
Common | System V | Description |
---|---|---|
1 | 1 | General commands |
2 | 2 | System calls |
3 | 3 | Library functions, covering in particular the C standard library |
4 | 7 | Special files (usually devices, those found in /dev) and drivers |
5 | 4 | File formats and conventions |
6 | 6 | Games and screensavers |
7 | 5 | Miscellaneous |
8 | 1M | System administration commands and daemons[3] |
Layout
All Man pages follow a standardise layout designed for displaying on a simple ASCII text display.
- NAME
- The name of the command or function, followed by a one-line description of what it does.
- SYNOPSIS
- In the case of a command, a formal description of how to run it and what command line options it takes. For program functions, a list of the parameters the function takes and which header file contains its declaration.
- DESCRIPTION
- A textual description of the functioning of the command or function. For programs, this section often includes explanations of available command line options.
- EXAMPLES
- Some examples of common usage.
- SEE ALSO
- A list of related commands or functions.[4]
Changing the Pager
The program that displays the manpage is stored in the MANPAGER
or PAGER
option can be used.[5][6]
environment variable. By default, it uses
--pagerless
or . Alternatively, the
-P
This environment variable can be set using export PAGER="program-to-use"
or added to the .bashrc
or .zshrc
file for persistence.
For example, using Neovim as the pager would be export PAGER="nvim +Man!"
, export PAGER="nano -"
to use Nano, and export PAGER="less"
to revert it to less.
For Fish shell, use set -x PAGER program-to-use
to set it for the current session, and set -Ux PAGER program-to-use
to set it globally.[7]
References
- ↑ https://en.wikipedia.org/w/index.php?title=Man_page#Command_usage
- ↑ https://en.wikipedia.org/wiki/Man_page#Manual_sections
- ↑ https://en.wikipedia.org/wiki/Man_page#Manual_sections
- ↑ https://en.wikipedia.org/wiki/Man_page#Layout
- ↑ https://www.mankier.com/1/man.mandoc#Environment
- ↑ https://www.man7.org/linux/man-pages/man1/man.1.html
- ↑ https://fishshell.com/docs/current/faq.html