ChatGPT解决这个技术问题 Extra ChatGPT

How to scroll up and down in sliced "screen" terminal

I just installed screen and like the idea to divide linux terminal into multiple pieces. But I can't figure out one thing: How to scroll up and down, when I'm in screen. When I'm using regular linux terminal I can achieve this with Shift + Pg Up or Shift + Pg Dn`. but unfortunatelly it doesn't work in divided terminal.

https://i.stack.imgur.com/0N9vH.png

https://i.stack.imgur.com/586le.png


J
Josh Correia

1.Ctrl+A, then Esc 2. After that, you should be able to move your cursor around using the arrow keys: ↑, ↓, PgUp, PgDn and sometimes using the mouse wheel 3. Return control: Q or Esc


Why can't I just use the navigation keys like I normally would?
@MihaiDanila: How would you "normally" use the navigation keys? The navigation keys are handled by the current foreground application. If it's an editor, they'll probably work. If it's a shell, they'll probably go back through your command history without scrolling the display.
If my pageup/pagedown keys work in a normal shell, I'd like for them to work in a shell from screen. I think that's what I'm asking here.
in this mode selection of any text is available by typing Space or Enter key once and finish your text selection with another Space or Enter. the selection will enter into the screen based clipboard. you could paste clipboard data later using Ctrl+a then ]
for all new folks coming here, @Eduardo answer works. See below. I tried on Ubuntu 18.04.
E
Eduardo Cuomo

Press Ctrl-a then [ will enter the copy mode, and you can scroll up and down like vim editor. Leave the copy mode by pressing Escape.


This answer also works when you are using Git Bash to log in a server.
J
Johan Boulé

Ctrl-a (default prefix) + [: Enter copy mode.

Esc: Quit copy mode.

Within copy mode:

Ctrl-u, Ctrl-d: Page up/down by certain amount of lines while preserving cursor position (default by half of the screen)

Ctrl-b, Ctrl-f: Page up/down by a full screen


ctrl-b paged up for me still - ctrl+f was the page down
E
Eduardo Cuomo

Use CTRL + A, then Escape to enter in "Copy mode". After that, you should be able to move your cursor around using the arrow keys. To exit, press Escape again.

Another way is to do the following to use Mouse Scrollwheel:

echo 'termcapinfo xterm* ti@:te@' >> ~/.screenrc

This is exactly what I needed. I need a screen session on the bastion host because of my sometimes flaky connection, but I absolutely need to have the option to scrollback with the terminal emulator software itself instead of screen, either huge chunks of output or line by line. I knew about the CTRL + A stuff, but that doesn't cut it for me.
methinks this should be the answer. It works well with standard configs under screen + ubuntu 16.04 + putty
This doesn't actually work if you switch screens. It feels like it works, but when you scroll back you quickly get garbage from other screens.
@Trevor maybe I'm doing it wrong, but it works fine for me?
@toast Is your screen session remote over SSH? That's the situation I am in and that might be why it works for you and not for me.
S
Sugan

Scrolling works in screen with 'terminator' in ubuntu.

sudo apt-get install terminator

Terminator is really good when you can use X11. Otherwise look at another solutions.