stopping less command from garbaging on the screen

N. Raghavendra raghu at
Wed Aug 13 18:29:16 UTC 2008

At 2008-08-12T17:07:08-07:00, Krishna Mohan Gundu wrote:

> When less exits the entire page history of the less session remains
> on the screen. How do I prevent less from doing that?

A brute-force method is to repaint the screen before `less', and
to clear it afterwards, which can be done in `tcsh' with

  alias less 'less -c \!* && clear'

However, this makes the screen contents prior to the `less' command
scroll off the top and become invisible.  To avoid this, you can use
termcap(5) instead of the above alias:

  setenv TERMCAP "xterm|xterm-color:tc=xterm-xfree86:"
  setenv LESS "-cs"
  setenv PAGER "less"

See and

> Also are you aware of any articles on the web that summarize the
> behavioral differences like these between linux and freebsd.

I used Debian for several years before moving to FreeBSD some years
ago.  I don't remember particularly making an effort to deal with the
differences between them, so I can't help you there.  FWIW, I found
Matthew Fuller's article `BSD vs Linux' at


N. Raghavendra <raghu at> |
Harish-Chandra Research Institute   |
See message headers for contact and OpenPGP information.

More information about the freebsd-questions mailing list