18

I saw "pager" in several places:

less is a terminal pager program on Unix

option -P for man Specify which output pager to use.

What is a pager? How is it related to and different from a terminal? Thanks.

7
22

As the name implies, roughly a pager is a piece of software that helps the user get the output one page at a time, by getting the size of rows of the terminal and displaying that many lines.

8
  • 1
    what is like with and without a pager? Thanks. – Tim Jul 11 '14 at 15:35
  • 5
    if you don't pipe your output through a pager (less, more and most come to mind), that output will appear on your screen all at once and thus you might lose something if said output is bigger than the number of lines of your terminal. – schaiba Jul 11 '14 at 15:39
  • You only need to use a pager if the output is longer than the terminal hight. However if the terminal has a scroll back, you may feel that you do not need it, as you can scroll back, but the pager still has the advantage of starting at the top. Scrolling back starts at the bottom. – ctrl-alt-delor Jul 11 '14 at 15:42
  • 4
    Scroll back is also finite. A pager is not limited to any particular size. – Faheem Mitha Jul 11 '14 at 16:08
  • 2
    Most pagers also provide extra features such as pattern searching and position marking. – Kevin Thibedeau Jul 11 '14 at 17:59
1

I would like to confirm the comments of @schaiba and @Faheem Mitha.

@schaiba :

if you don't pipe your output through a pager (less, more and most come to mind), that output will appear on your screen all at once and thus you might lose something if said output is bigger than the number of lines of your terminal.

@Faheem Mitha:

Scroll back is also finite. A pager is not limited to any particular size.


You can try easily by changing the terminal environment variables setttings

First, try man bash (You need a command manpage that's long enough. Google told me man bash is longest one) with default pager. (I don't know which it's the default one but whatever it definitely has one).

Then set PAGER to empty. (Need to export or it won't be written into terminal environment variables)

PAGER=
export PAGER

Again, try man bash. You will find that even if you sroll up, you can't see the beginning of the man bash page.

So now you(I) understand how pagers matter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.