Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

Previously, if I ran something | less, and then press q, it used to return me to the prompt with the output of less still visible.

$ seq 1 100 | less
$ <prompt here. I can still see the output of less>

But now, after I installed Zsh (with oh-my-zsh. It doesn't work in bash too), the terminal looks like this:

$ seq 1 100 | less
<less shows up, I press :q and it is cleared>
$ <prompt here. Output of less disappears.>

I searched for a less config file and found none. Is there any way I can get less to behave the previous way? Having the output visible is very handy.

share|improve this question
up vote 3 down vote accepted
seq 1 100 | less -X

see: man less

-X or --no-init
Disables  sending  the  termcap  initialization and deinitialization strings to the terminal. 
This is sometimes desirable if the deinitialization string does something  unnecessary, like clearing the screen.
share|improve this answer
Thanks, that was it! I added it to ~/.lesskey and it runs with all the git etc. – Abdulsattar Mohammed Mar 5 '14 at 17:42

As jhscheer mentioned everything is in the man page for less

Add this to your zsh profile .zshrc to make it play nice with git :)

LESS="-XRF"; export LESS


Actually in your case it's probably better to run the following command to avoid modifying the global behaviour of less:

git config --global core.pager 'less -XRF'

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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