135

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.

That's what I mean when saying screen and divided terminal: enter image description here

And that's a regular termina (just in case): enter image description here

Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
Vor
  • 33,215
  • 43
  • 135
  • 193

5 Answers5

304

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

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
Anthony
  • 3,492
  • 1
  • 14
  • 9
  • 7
    Why can't I just use the navigation keys like I normally would? – Mihai Danila Jan 22 '15 at 16:08
  • @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. – Keith Thompson Mar 14 '16 at 20:36
  • 2
    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. – Mihai Danila Mar 15 '16 at 21:37
  • However if its in [control+a -> escape] mode you will not get any update on the screen till you exit this mode(using escape). – Rishi Barve May 25 '17 at 07:44
  • 1
    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 **]** – Oleg Kokorin May 27 '17 at 07:47
  • 1
    for all new folks coming here, @Eduardo answer works. See below. I tried on Ubuntu 18.04. – paramvir Jun 21 '20 at 01:49
  • You can than also use the **page up** & **page down** keys (iso arrow keys) – Melroy van den Berg Mar 04 '21 at 15:58
  • It is working, but it have limited scroll back buffer, I cannot scroll up more than two pages. Using screen to serial on mac. – Ernest Poletaev Mar 22 '21 at 01:54
  • Works on Ubuntu 20.04.3 LTS. Thanks a ton! – Suvarna Pattayil Nov 12 '21 at 07:34
42

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.

Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
Wei-Yan Lin
  • 521
  • 4
  • 6
31

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

Johan Boulé
  • 1,936
  • 15
  • 19
galactica
  • 1,753
  • 2
  • 26
  • 36
30

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
Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
  • 2
    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. – Vladimir Feb 15 '17 at 12:15
  • 4
    methinks this should be the answer. It works well with standard configs under screen + ubuntu 16.04 + putty – DM8 Mar 02 '18 at 13:46
  • 2
    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 Mar 22 '19 at 00:27
  • @Trevor maybe I'm doing it wrong, but it works fine for me? – toast May 20 '19 at 03:39
  • 1
    @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. – Trevor Jun 04 '19 at 23:26
  • @Trevor Yeah, remote over SSH. I'm on a mac using iterm2 in case that has something to do with it. – toast Jun 06 '19 at 01:55
4

Scrolling works in screen with 'terminator' in ubuntu.

sudo apt-get install terminator
Sugan
  • 335
  • 3
  • 10