32

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?

Oliver Salzburg
  • 86,445
  • 63
  • 260
  • 306
Nadal
  • 939
  • 3
  • 8
  • 11

5 Answers5

44

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.

clhy
  • 6,283
  • 8
  • 34
  • 66
Babu
  • 1,347
  • 12
  • 13
  • Thanks that works. Is there a faster way to go up rather than just having the up arrow pressed. – Nadal May 07 '10 at 15:27
  • 11
    @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 May 07 '10 at 16:09
  • 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 May 07 '10 at 19:27
  • 1
    What's this *quickly?* It does not seem to matter how fast you do it... – Kevin Panko Aug 18 '10 at 15:11
  • @kevin: quite right, the "quickly" was meant to explicitly convey "not simultaneously". – Babu Aug 18 '10 at 17:09
  • Isn't piping the output to less also an option, or am I missing something? – Vic Goldfeld Mar 25 '13 at 03:36
  • @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 Oct 25 '13 at 18:49
  • But this remains annoying... see the next two answers for much more elegant solutions... – Dagelf Aug 04 '15 at 19:00
17

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
  • 515
  • 4
  • 11
9

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
  • 306
  • 2
  • 4
  • 2
    `bindkey` is the solution, but binding [Page Up] or [Page Down] will interfere with using `less`. We just need one key to enter `copy mode`. For completeness: To bind the [Insert] key (otherwise useless and right besides the navigation keys) with `copy mode`, we should add `bindkey -k kI copy` to `.screenrc` and restart the screen session. – Small Boy Dec 25 '20 at 15:33
6

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

Doug Harris
  • 27,333
  • 17
  • 78
  • 105
6
  • 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
  • 161
  • 1
  • 3