How do I scroll back inside a GNU Screen session?
Asked by
MellowCactus47
Scrolling works normally in my terminal, but when I enter a GNU Screen session, pressing the usual scroll keys produces visible escape characters such as `^[[A` instead of moving through the terminal history. I tried Ctrl+A and Ctrl+PageUp without success. What is the correct way to scroll back while inside Screen?
Answers
If the session was interrupted and the terminal remains in the alternate screen buffer, normal scrolling can also appear broken. Usually this is fixed by cleanly exiting a full-screen program such as `less` or by resetting the terminal state. Do not send alternate-buffer escape sequences while you are actively inside Screen, since that can make the display state more confusing.
Reply to this answer
The terminal emulator owns its normal scrollback, but Screen is a full-screen terminal multiplexer and maintains its own history. That is why regular terminal scrolling may not behave as expected inside the session. If the session is using an alternate screen buffer, you may need to configure Screen or the outer terminal to handle scrolling, but copy mode is the reliable built-in solution.
Reply to this answer
Use Screen's copy mode to browse its scrollback buffer. Press Ctrl+A, then `[`. Once copy mode is active, use the arrow keys, Page Up, or Page Down to move around. Press `q` or Escape to leave copy mode.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowCactus47: That workedโCtrl+A followed by `[` puts me into the scrollback mode I was looking for.