0

The question is simply this: how is the PAGER variable set by default for all users in Ubuntu Linux? Where is this done (in terms of a standard file or location)?

A secondary question is how might this get unset?

I have been told to use /etc/profile and/or /etc/environment to fix it, and I am experimenting with these as solutions, but neither of these was used to set the PAGER variable originally. Where should this have been done?

Here is the problem that led me to this question:

man stopped working on my Ubuntu (18.04) system a while ago. I did not notice that it had failed at first until git log also failed and I saw this answer on fixing that. When I use the command export PAGER=more it fixes the problem with both man and git.

To fix the problem for me, I have added the line:

export PAGER=more

to my .bashrc file. It took some looking around to realize the difference between that command and just PAGER=more, but this answer spelled it out for me. I guess my calls to man and git are subprocesses, and adding the export in front is needed for them to have access to the variable. (If that is wrong, please inform me!)

Doctorambient
  • 356
  • 3
  • 5
  • 1
    Shouldn't you rather fix `less` than use the much less powerful `more`? – Benjamin W. Oct 31 '18 at 20:09
  • @BenjaminW. Sure that is a choice. But it does not address the question. – Doctorambient Oct 31 '18 at 20:21
  • That's why it's a comment ;) Isn't [this question](https://stackoverflow.com/questions/1641477/how-to-set-environment-variable-for-everyone-under-my-linux-system) the same as you're asking? – Benjamin W. Oct 31 '18 at 20:52
  • Why not `/etc/profile`? – Rafael Oct 31 '18 at 21:05
  • @Rafael I don't know if it should be `etc/profile` -- I did not avoid that _per se_ it just did not come up in my search. I guess my question then is "why is the pager **not** set here already? Is it usually set somewhere else?" It certainly is not currently set to anything in my Ubuntu 18's `/etc/profile`. – Doctorambient Nov 01 '18 at 18:25
  • @BenjaminW. are you recommending that answer for the `/etc/profile` part or the `/etc/environment` part? – Doctorambient Nov 01 '18 at 18:28
  • In general, if `man` is not working then you can check `man man` and read under `--pager` the following _Specify which output pager to use. By default, man uses **`less -s`**. This option overrides the `$MANPAGER` environment variable, which in turn overrides the `$PAGER` environment variable._. Remark that the default command depends from distribution to distribution. Oh wait, `man` is not working ... use `man --pager='less -s' man` – kvantour Nov 01 '18 at 18:41
  • I just linked to the whole Q&A because the question seems to be identical. It doesn't look like there is a single correct answer – you'd have to figure out how Ubuntu does it. But `/etc` looks like a good starting point. – Benjamin W. Nov 01 '18 at 19:22
  • @kvantour Thanks for that, I did not see that before. But Ubuntu does not have the part about `less -s`. – Doctorambient Nov 08 '18 at 18:55

0 Answers0