How to scroll up and look at data in GNU screen

27

13

I am using a mac (snow leopard). I am a ruby on rails developer and I watched a screencast on GNU screen and am trying it out. So far I like it.

On a window when I start server I get to see the log messages. However I can't seem to scroll up. I do get a scroll bar. However when I use the scroll bar and scroll up I don't see anything.

How do people use GNU screen and scroll up?

Nadal

Posted 2010-05-07T14:10:04.477

Reputation: 809

Answers

41

There's a 'copy mode' in screen, activated by pressing, Ctrl + A, followed by [. This gives you a cursor that you can use to scroll backwards.

Babu

Posted 2010-05-07T14:10:04.477

Reputation: 1 297

But this remains annoying... see the next two answers for much more elegant solutions... – Dagelf – 2015-08-04T19:00:19.560

Thanks that works. Is there a faster way to go up rather than just having the up arrow pressed. – Nadal – 2010-05-07T15:27:19.017

9@dorelal: The vim-like shortcuts Ctrl-U and Ctrl-D move up a half page and down a half page while in copy mode. Also, ESC will take you out of copy mode. – Trey Hunner – 2010-05-07T16:09:21.893

5@dorelal I usually use the other shortcut ctrl-A, then Esc quickly, to get into copy mode rather than [. It is easier for me to remember. – Jarvin – 2010-05-07T19:27:21.140

1What's this quickly? It does not seem to matter how fast you do it... – Kevin Panko – 2010-08-18T15:11:54.820

@kevin: quite right, the "quickly" was meant to explicitly convey "not simultaneously". – Babu – 2010-08-18T17:09:37.820

Isn't piping the output to less also an option, or am I missing something? – Vic Goldfeld – 2013-03-25T03:36:07.370

@VicGoldfeld Yes, that is also an option, but this works even after you forgot to pipe the output, so it's still useful. – Kevin Panko – 2013-10-25T18:49:18.097

16

Add the following to your ~/.screenrc:

termcapinfo xterm ti@:te@
termcapinfo xterm-color ti@:te@

This will let you use the Terminal.app scrollbar instead of relying on screen's scrollback buffer.

Frank Szczerba

Posted 2010-05-07T14:10:04.477

Reputation: 505

2This should really become a default setting. I keep on coming back here to get this, thanks! – Dagelf – 2014-10-17T13:43:48.823

1....And again.... and again... the gift that keeps on giving... – Dagelf – 2015-07-08T16:40:50.110

1...And again... – Dagelf – 2015-08-04T19:00:30.970

Or: termcapinfo xterm* ti@:te@ for both. – kenorb – 2016-01-17T12:30:49.400

It doesn't work with SHIFT+PgUp, so I still can't scroll up the terminal. – hopeseekr – 2019-11-02T12:22:35.670

7

Take a look at GNU Screen: Working with the Scrollback Buffer for a good introduction.

Doug Harris

Posted 2010-05-07T14:10:04.477

Reputation: 23 578

that was an awesome introduction. thanks mate. – Nadal – 2010-05-07T17:00:50.787

And... it's gone. 404 – Tom Stephens – 2014-01-07T22:12:17.337

Replaced link with archive.org link – Doug Harris – 2014-01-08T16:01:00.590

7

The correct way is to use the copy mode, as Babu pointed out.

You could speed things up a bit by automatically entering into copy mode when you press your favourite scroll keys.

For example, using PgUp and PgDown:

# easier scroll
bindkey "^[[5~" eval 'copy' 'stuff ^b'  # PgUp   | Enter copy/scrollback mode and page up
bindkey "^[[6~" eval 'copy' 'stuff ^f'  # PgDown | Enter copy/scrollback mode and page down

lgaggini

Posted 2010-05-07T14:10:04.477

Reputation: 256

5

  • I use Ctrl+A Esc to go in copy mode.
  • Then use arrows or PageUp/PageDown to move through the scroll buffer.
  • To exit copy mode, just hit Esc.

that’s a little more intuitive by this way.

TeChn4K

Posted 2010-05-07T14:10:04.477

Reputation: 151