Fun with ones and zeros



"man" annoyance

I work on several different Unix-type machines, some FreeBSD, some Linux, and there are always small differences between them that can be very annoying.

One that's driven me crazy many times is how on some machines, when using man to read a manpage, after getting to the part I'm interested in, and hitting 'q' to quit - the contents of the manpage completely disappear and the screen is restored to what was shown before I ran man. Other machines I work on don't do that - the contents of the manpage remain on the screen so you can see them as you type the next command.

After finally getting fed up, I looked into this and it turns out the machines that were acting the way I like have the PAGER environment variable set to more, so man uses that instead of less which has the screen-restore-on-quit behavior. Adding:

PAGER=more; export PAGER

to .bashrc seems to have done the trick on my Ubuntu box. Seems the FreeBSDs already had this by default.

It's not a big deal, but I'm just jotting this down in case anyone else has the same annoyance. Good luck finding this in Google though, if you're just using words like 'more', 'less', and 'man' ;)

posted: Saturday, 16 February 2008 19:12 | tags: unix


Comments

#1 name commented, on February 19, 2008 at 5:25 a.m.:

Very useful! I was actually looking at your blog because of your Exim work, didn't expect to stumble on this gem :-)

#2 alex_avk commented, on February 27, 2008 at 7:54 a.m.:

In fact, 'less' is superior to 'more'. Once 'less' has been released, I never returned to 'more'. I would do this, instead:

export PAGER="less -X"

so, we use same 'less' pager, but without clearing the screen.

#3 Tom commented, on April 15, 2008 at 6:06 a.m.:

Hey, I don't know if you are a vim man, but I have these aliases/functions (bash)

vman()
{
/usr/bin/man -w "$@" >/dev/null && ( /usr/bin/man "$@" | /usr/bin/col -b | /usr/local/bin/vim -c 'set ft=man nomod nolist noma' - )
}
alias man='vman'

Vim man pages are pretty :)

Post a comment








A Django site.

Valid XHTML 1.0 Transitional