I saw "pager" in several places:
less
is a terminal pager program on Unixoption
-P
forman
Specify which output pager to use.
What is a pager? How is it related to and different from a terminal? Thanks.
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.
The most popular pagers in a UNIX text environment are more
and less
.
The latter is kind of a joke as less
can actually do more then more
.
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
ls
in a directory full of files. Then add | less
to end of command. You should see just the first page. Then press space to go to next page.
– ctrl-alt-delor
Jul 11 '14 at 15:46
pg
. (2) While most (if not all) terminals have a finite scroll-back capacity, some pagers (e.g., more
) cannot scroll back at all when the input is from a pipe. (3) An interesting wrinkle is that some pagers (in some environments) write into the terminal’s scroll-back memory, so you can quit the pager and then still scroll back and review (re-see?) its output. Others create a separate viewing environment, so, when you terminate the pager, its output vanishes. …
– Scott - Слава Україні
Jul 12 '14 at 01:13
pager
is must for consoles where scroll buffering is not possible. ie: in grub rescue mode. you can't scroll.
– Akhil
May 12 '21 at 15:41
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
andmost
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.
less
is the gnumore
. (gnu can be pronounced the same as new) – ctrl-alt-delor Jul 11 '14 at 15:43| vim -R -
at the end of a command. – jrand Jul 11 '14 at 19:10