1

Hello I am working on a raspberry pi with Raspian version 10 (buster), and I recently installed GNU Screen version 4.06.02. When I used to look at files with less, the contents would appear on what seemed like a different screen, so that when I exited out with 'q' I would return to my base terminal view. Now when I use less with screen it works like a weird cat command, showing my base terminal and the contents of the file underneath. When I fully close the terminal and SSH back into my pi, less works like normal. I haven't been able to find anybody with the same issue, and I don't even know where to start looking in order to fix this, any help would be appreciated.

Matthew
  • 11
  • what does echo $LESS report inside and outside your GNU screen session? – iruvar Sep 11 '20 at 01:23
  • This actually gets asked a lot, in both directions and for several full-screen programs. This is a variation on https://unix.stackexchange.com/q/85398/5132 from 7 years ago, for instance. It's also https://unix.stackexchange.com/q/241788/5132 from 4 years ago. Or https://unix.stackexchange.com/q/282686/5132 . Or indeed https://unix.stackexchange.com/q/1356/5132 from 10 years ago. – JdeBP Sep 11 '20 at 06:47

1 Answers1

1

The setting you're probably looking for is altscreen. This is an optional feature (not all physical terminals support it).

This can be turned on by adding the line altscreen on in $HOME/.screenrc. Now when screen starts up it will enable the behavior you want.

In the current session you can to Control a :altscreen on to enable it immediately.

  • This answer is a bit confusing. The first paragraph suggests that GNU screen won't be able to implement alternate screen switching in the emulated pseudo-terminals unless the outer "physical" terminal it runs itself in supports alternate screen switching. That's not true. I suggest changing it to: What you're looking for is "alternate screen switching", an optional feature not implemented in all terminals. GNU screen supports it, but it's disabled by default. You can enable it with "altscreen on", etc, etc. –  Sep 11 '20 at 19:04
  • The answer is at best misleading: screen simulates the alternate-screen feature, rather than relying upon the terminal. To see that, you have to read the manual page. – Thomas Dickey Mar 24 '21 at 23:02