Preventing the pager less from exiting when scrolling beyond the end of file

2

0

I like less and use it as my default pager in Linux.

However, there are times that I am scrolling down through a large document quickly and less exits when I reach the end of the document before I have time to stop scrolling. I'd like less to exit only I type q, and not because I ask it to scroll beyond the end of the document. Is that possible?

Thanks

Amelio Vazquez-Reina

Posted 2011-04-04T21:53:33.257

Reputation: 5 686

Answers

6

Pass -+e -+E to less to disable quit-at-EOF.

Ignacio Vazquez-Abrams

Posted 2011-04-04T21:53:33.257

Reputation: 100 516

A sidenote: if you experience the same problem with zless, setting LESS env variable does not help if zless is – quite counter-intuitively – using more as the pager. If that's the case, set PAGER=/usr/bin/less. – tuomassalo – 2017-05-28T08:34:06.660

1You can also set your LESS environment variable for any flags you want to set for all invocations. – Rich Homolka – 2011-04-04T22:35:22.627