4

When using man to view manpages on FreeBSD 10.3-RELEASE-p11 I get back to the command promt after scrolling to EOF. What I want: man should not quit when I reach the end of the manpage as I may want to scroll back up...

On Xubuntu that works well. Any tips on how to do that?

I read that the program less has the option -E to "quit-at-eof". Is it possible that man has this option turned on by default? If so I couldn't find any information on that on the manpage of man.

1
  • Does echo $MANPAGER show anything? Or echo $LESS?
    – muru
    Oct 27, 2016 at 6:53

1 Answer 1

4

The information is on the manual page for man. It's in the section on environment variables.

If neither MANPAGER nor PAGER exist in the environment, the man command behaves as follows. If coloured manuals are requested, it invokes less -sR; otherwise it invokes more -s.

The behaviour of the less and more commands, in turn, is that less does not quit at end of file by default whereas more does.

So the simplest approach, which is what I do myself, is to turn coloured manuals on. In my ~/.login_conf I have (omitting some irrelevant environment variables):

me:\
    :setenv=MANWIDTH=tty,MANCOLOR=1,MANITALIC=1:\
    :hushlogin:

The MANWIDTH and MANCOLOR environment variables are documented in that same part of that same manual page.

The MANITALIC environment variable invokes a patch to man that I wrote that turns on grotty's (already present) ability to generate italic ECMA-48 output, making all of the manual pages that are marked up with things like .I and .BI generate actual italic text on my screen. My terminal supports italics. If yours does too (and many do), you might like to try this.

~/.login_conf is FreeBSD's shell-agnostic way of setting environment variables for an interactive login session, by the way. You can use your shell-specific mechanism, whatever your shell of choice is, if you like. man login.conf. ☺

Further reading

1
  • The .login_conf-trick didn't work, but I found out that $PAGER was set to "more". I set it to "less -sR" like you said and now it works perfectly. Thanks a lot for your very clear and detailed answer. :-) (Okay, I reread your answer and you already said that your trick only works if $PAGER and $MANPAGER aren't set. My bad.^^)
    – itmuckel
    Oct 28, 2016 at 8:23

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.