What is the default PAGER used by man pages?

15,474

Solution 1

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.

Solution 2

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.

Share:
15,474

Related videos on Youtube

Maythux
Author by

Maythux

Love To Learn Love To Share

Updated on September 18, 2022

Comments

  • Maythux
    Maythux over 1 year

    What is the default PAGER used by man pages.

    I,e what is the program runs the man pages?

    It look some like more or less. I'm sure it's not more since more doesn't support reverse backward.

    • sampathsris
      sampathsris over 7 years
      It looks more or less like more (or less), I think.
  • Maythux
    Maythux almost 9 years
    Thanks.. I'm confused which one to mark as answer. Both were quick with good information and two different methods to check the symlink of pager.
  • Maythux
    Maythux almost 9 years
    Thanks.. I'm confused which one to mark as answer. Both were quick with good information and two different methods to check the symlink of pager.
  • muru
    muru almost 9 years
    @NewUSer Toss a coin. :)
  • Maythux
    Maythux almost 9 years
    Sorry Friend I'm considering @muru answer since he was the first to answer.. But I wish I could choose both, you desrve
  • Ron
    Ron almost 9 years
    In addition I think you can change this with the MANPAGER in the environment.
  • muru
    muru almost 9 years
    @Ron oh, yes. But that variable is not set by default, AFAICT.
  • Maythux
    Maythux almost 9 years
    @muru I'm considering yours, you answered first. Eventhough the other answer is perfect
  • muru
    muru almost 9 years
    @NewUSer ah, don't. Pick the best answer, not the earliest.
  • terdon
    terdon almost 9 years
    @NewUSer don't worry about it. Both Muru and I have enough rep to keep us happy :) Just accept whichever one you feel answers your question better. I assure you that nobody will be offended.
  • Maythux
    Maythux almost 9 years
    both of answers are good enough. Thanks for your sportsman soul
  • Ron
    Ron almost 9 years
    @muru yeah, from man man : -P overrides MANPAGER which overrides PAGER
  • alhelal
    alhelal over 6 years
    If once I change the pager then how to back in default?
  • muru
    muru over 6 years
    @BandaMuhammadAlHelal how did you change it?
  • alhelal
    alhelal over 6 years
    @muru actually I don't know for which that was happend because of I have done many things at a time.
  • muru
    muru over 6 years
    @BandaMuhammadAlHelal in that case, you should post a new question with the output of env and update-alternatives --display pager, and the effect when you run man -D <some-manpage>, and any changes you did that you can remember.
  • alhelal
    alhelal over 6 years
    @muru what does mean by the priority?
  • alhelal
    alhelal over 6 years
    @terdon readlink -f /usr/bin/pager shows /bin/less but when I run man command it opens in more pager. why?
  • Alberto Pau
    Alberto Pau about 6 years
    @alhelal because of the MANPAGER or PAGER environment variables, or you have man aliased to include a -P parameter.
  • alhelal
    alhelal about 6 years
    @TheGatorade Now what can I do(e.g.man -P less results error)?
  • Fabián
    Fabián over 4 years
    From Debian 9.8.0, if you do man pager it'll point you to the man page of less. That sums it up (Debian-wise).