6

When I use a fullscreen CLI program on Ubuntu (like less or vim) in xterm and then quit it, the fullscreen output of that program is not visible anymore. However, when I do the same on FreeBSD, the fullscreen output just stays there, above the line for the next command. Is there a way to enable the former behaviour on FreeBSD, for example with a Bash option?

3 Answers3

9

FreeBSD's termcap definition for "xterm" omits the alternate-screen escape sequence. That's been discussed here before. You could do some workaround such as (since they left the rxvt entry alone):

#!/bin/sh
TERM=rxvt tput ti
less "$@"
TERM=rxvt tput te

which will "work" since rxvt uses the xterm escape sequence for this case. Simply setting TERM=rxvt in your environment will not give good results, but this piece is useful.

Alternatively, you could modify /etc/termcap and recompile the terminal database. For reference, here's a link to the change which removed the alternate-screen:

revision 200503 by dougb, Mon Dec 14 07:18:31 2009 UTC

The change comments

Add some example xterm*-clear entries to the termcap files to make it easier for people to enable that behavior.

but the drawback to that is that (again) you wouldn't be able to use this in your shell if you wanted to pass it to remote machines (other than FreeBSD of course). None of those "xterm*-clear" entries will be in Ubuntu.

Further reading:

Thomas Dickey
  • 76,765
0

To have less leave the last page up, export LESS=X. See the man page. I also like e and F.

0

If you want an easy fix, just put this in your .bashrc on FreeBSD:

export TERM=xterm-clear