What is the default PAGER used by man pages?
From man man
:
... The pager can be
specified in a number of ways, or else will fall back to a default is
used (see option -P for details).
...
-P pager, --pager=pager
Specify which output pager to use. By default, man uses pager
-s. This option overrides the $MANPAGER environment variable,
which in turn overrides the $PAGER environment variable. It is
not used in conjunction with -f or -k.
pager
(/usr/bin/pager
) is set using the Debian alternatives system (via /etc/alternatives/pager
), and defaults to less
.
$ update-alternatives --display pager
pager - auto mode
link currently points to /bin/less
/bin/less - priority 77
slave pager.1.gz: /usr/share/man/man1/less.1.gz
/bin/more - priority 50
slave pager.1.gz: /usr/share/man/man1/more.1.gz
/usr/bin/pg - priority 10
slave pager.1.gz: /usr/share/man/man1/pg.1.gz
/usr/bin/w3m - priority 25
slave pager.1.gz: /usr/share/man/man1/w3m.1.gz
Current 'best' version is '/bin/less'.
Apparently, this particular default (using a command named pager
) is a Debian-derivative trait. See Which systems have 'pager' shortcut/alias? over on Unix & Linux.
By default, it's less
. As explained in man man
:
-P pager, --pager=pager
Specify which output pager to use. By default, man uses pager
-s. This option overrides the $MANPAGER environment variable, which in turn overrides the $PAGER environment variable. It is not used in conjunction with -f or -k.The value may be a simple command name or a command with argu‐
ments, and may use shell quoting (backslashes, single quotes, or
double quotes). It may not use pipes to connect multiple com‐
mands; if you need that, use a wrapper script, which may take the file to display either as an argument or on standard input.
On Debian-based systems, including Ubuntu, pager
is a symlink to less
:
$ readlink -f /usr/bin/pager
/bin/less
This means that man
's default, pager -s
, is less -s
. You can change this by i) using the -P
option of man
; ii) setting the MANPAGER
or PAGER
environmental variables.