Where are the commands available in the man page window documented, and are these commands system-dependent?
It is indeed right in the manual page for man
, under the "Controlling formatted output" subheading and repeated later on in the "ENVIRONMENT" section for good measure:
By default, man uses pager -s
.
The manual page explains how there is a hierarchy of environment variables and command-line options (PAGER
, MANPAGER
, and --pager
) for overriding the default.
This is how it reads on systems such as Debian Linux. On systems such as Oracle Linux, in contrast, the man-db
package has been built with a different default, which is however still reflected right there in the manual page in the same places:
By default, man uses less -s
.
The man-db
package attempts to auto-detect, at compile time, which default pager to build-in to the command, and document in its manual page, out of less
, more
, and pager
.
On systems such as Debian Linux, the pager
command is part of the "alternatives" system and can map to one of several actual commands:
jdebp % update-alternatives --list pager /bin/less /bin/more /usr/bin/pg /usr/bin/w3m jdebp %
So one consults their respective manual pages for how to drive them from the keyboard, according to which alternative has been chosen. Usefully, the Debian alternatives system keeps the manual page in synch with the chosen command, so reading this manual page is quite straightforward:
man pager
Man uses a pager to show the content.
The exact details depend on which version of man
you are using.
For the version used on many systems:
- If the option
-p pager
is given then that pager is used. - Otherwise if the environment variable
MANPAGER
is set it is used. - Otherwise if
PAGER
is set it is used. - Otherwise the default is to use
/usr/bin/less
If the manual page is in HTML format then BROWSER
is used instead of MANPAGER
/PAGER
Debian uses man-db
which has different defaults.
Read man man
for the details
Thanks to @Rastapopoulos, I find a line related to less
in man man
on a old Linux box (man
version: 1.6f) in the ENVIRONMENT section that states,
BROWSER The name of a browser to use for displaying HTML manual pages. If it is not set,
/usr/bin/less
is used.
However on a newer box (man
version: 2.6.3) this line has been replaced by
BROWSER If $BROWSER is set, its value is a colon-delimited list of commands, each of which in turn is used to try to start a web browser for man --html. In each command, %s is replaced by a file? name containing the HTML output from groff, %% is replaced by a single percent sign (%), and %c is replaced by a colon (:).
Based on these information I believe it is formatted in less
by default (at least for the first case). However, even if this is the case, it is documented in a way that doesn't seem clear to me (or I have learnt the man
command the wrong way).