Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Using screen, commands like less and man don't clear the screen afterwards

When I quit 'less' in a normal bash, it clears the previous contents displayed by 'less' and shows the bash contents again. This is the defualt behavior and what I desire.

However, when I use 'less' in a 'screen' session (still bash inside the screen session), after quitting it does not erase the contents shown by 'less' and the contents of bash are gone (still having a new bash comand line prompt though).

How can I make it so that less does clear its display after quitting, even though I am using it within a 'screen' session?

share|improve this question

marked as duplicate by Sathya Sep 27 '12 at 12:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 7 down vote accepted

Try adding this command to your ~/.screenrc file:

altscreen on

You can also do Ctrl-a : altscreen on from within screen to toggle it on or off in the current session.

Make sure your $LESS environment variable does not contain X in its value.

share|improve this answer
Didn't work... uncommenting "altscreen on" did. – Cyprian Guerra Sep 16 '14 at 12:05

Also check that these work:

$ tput smcup | od -c
$ tput rmcup | od -c

they should print something like:

0000000 033  [  ?  1  0  4  9  h

rather than:

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.