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

(Sorry for the title. Any suggestions?)

I've set my commandline PS1 to cover 3 lines:

  1. white space
  2. user, server and pwd
  3. $ or # to input

I think less (or more?) is configured to break after window's height - 1, because when I do a $ git log, the first two lines are invisible at the top of the window and the rest is scrollable.

I'm not sure who handles this scrolling and its configuration, but I assume GIT uses less/more.

Where can I configure that my scrollable window is window height - 3 lines and not window height - 1?

More info:

  • If I cat lines.txt | less with a 23 line file, it shows the entire file and no scrolling.
  • If I do the same with a 24 line file, it doesn't show line 1 (and no scrolling).
  • With 25 lines: doesn't show lines 1 and 2 (and no scrolling).
  • With 26 lines: shows line 1 and scrolling!

The less breakpoint is at the wrong height...

share|improve this question
What keeps your prompt at the bottom of your screen while less and more are running? o.O My screen session has a statusline forced at the bottom, but it also shrinks the reported window size by 1 so that applications don't have this issue. – Darth Android Jun 12 '12 at 21:27
I think it only happens if there aren't enough lines to go to scroll mode (window height - 1), but there are enough for some to be invisible (window height - 3, since my PS1 is 3 high). (I can't reproduce it now, because I've just pushed which clears the log =)) – Rudie Jun 12 '12 at 21:59
Yeah that's it. If I cat+less a file with 26 lines, it shows line 1 at the top and line 25 and : at the bottom. If I do the same for a 24 line file it shows line 2 at the top and no scrolling. (If 25 lines, lines 1 and 2 aren't visible.) – Rudie Jun 12 '12 at 22:03

What is the output of echo $LESS ?

Does it work right if you LESS="" less /path/to/25line/file.txt ?

share|improve this answer
Output of $ echo $LESS is -FRSX. No idea what that means.... Scrolling behaviour is the exact same with the LESS="". – Rudie Jun 12 '12 at 22:26
The -F is your problem. It causes less to quit if there's less than one screen of text, but that expects a 1-line prompt. I don't think there's a way to redefine what 'one screen' is, but you can export LESS="-RSX" to fix the behavior. Stick it somewhere like your .profile or similar to make it persist. – Darth Android Jun 12 '12 at 22:29

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.