Sample Header Ad - 728x90

How do I change the PAGER variable for man if it's possible?

2 votes
2 answers
1697 views
I'm not an expert in Linux, but I was reading an introductory book and found that man pages use the PAGER environment variable to show the content of man pages. I checked printenv and didn't find any PAGER variable there. However, since it's a binary, and the path to /usr/bin is in my path, there is a program called pager in Linux as well, and I think it's what is the default option for $PAGER. Just out of curiosity I would like to know how to modify this PAGER variable. I tried adding one to my bashfile but that didn't work, couldn't find how pager can be changed. And whats so special about pager - I expect any program that can read from stdin, or support piping stuff, can be pager, can vim be a pager? Internally it seems the man just uses sed to send data to a defined PAGER variable because doing following works, but fails.
env PAGER=/usr/bin/nano man printf
and I get an error, like following enter image description here
Asked by Yanjan. Kaf. (129 rep)
Oct 13, 2023, 11:43 AM
Last activity: Oct 14, 2023, 05:17 AM