I'm not sure how to describe this but I'll try by comparing it to vi. When I open vi, do something, and then exit vi it brings me back to the terminal where I can see all of the commands I had previously executed.

Is there a way that I can get less to to behave similarly instead of seeing the lines of the file I had just viewed? Preferably a command so that I can decide at the last minute.

Thanks, Gregg


less -X might be what you're looking for, that's the option to disable preserving and resetting the screen

It could be that you're sending some less options by default. Do you have $LESS defined in your environment?

less -+X will reset the option, you could try calling it like that and see if it helps.

| improve this answer | |
  • I didn't realize it, but I did have a less environment. Once I found where it was set and commented it out it works as expected. I've played around with the -X stuff but it's not clear to me whether it was the cause. My LESS variable was set to: --no-init --clear-screen --LONG-PROMPT --RAW-CONTROL-CHARS --shift 5 --buffers=8192 – Gregg Apr 1 '16 at 13:10
  • cool! Yeah, I wasn't sure about -X +-X I just picked one that I know affects screen resets and saves to use as an example – cms Apr 1 '16 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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