How to scroll in GNU Screen
GNU Screen is great.
But, after half a year of using it, I've only now figured out how to
scroll into screen's buffer (courtesy of
this tutorial). Normally, I just use SHIFT+PGUP to scroll
up in urxvt's buffer. However, if I have two regions in screen, this
doesn't work. To scroll in screen's buffer, I need to enter "copy mode".
To do this, type C-a [ or
C-a ESC. (The latter option works great for me
because I bound the prefix key to the backtick key instead of
C-a.) Once in "copy mode", I can scroll using the
arrow keys or PGUP/PGDOWN keys. To exit "copy mode", I press ESC. Scrolling
within screen's buffer instead of urxvt's also prevents me from losing my
place in my scrollback buffer when I switch screen "windows" (terminal
sessions).
Other notes:
C-a Ssplits into two regionsC-a tabswitches input focus to the next regionC-a Xkills the current regionC-a :resize numlinesresizes the current region to numlines lines.
Keyboard shortcuts (updated 2009-04-01)
If you don't want to hit C-a ESC PGUP everytime to page up,
you can create keyboard shortcuts. I use CTRL+K to scroll up one line and META+K to
scroll up one page (I know these are kind of weird key combinations). To create these
shortcuts, I put the following in my .screenrc.
bindkey "^[k" eval "copy" "stuff ^b" # enter copy mode and move up one page bindkey "^k" eval "copy" "stuff k" # enter copy mode and move up one line bindkey -m "^[k" stuff ^b # move up one page bindkey -m "^k" stuff k # move up one line
Now, when I'm in screen and press M-k, screen enters copy mode and
scrolls up one page. Likewise, C-k enters copy mode and scrolls up one line.
As before, to exit copy mode, hit ESC.
How to copy and paste in screen (added 2010-02-03)
Thanks to this GNU Screen cheat-sheet.
- Enter scrollback mode using
C-a [orC-a ESC - Press the space bar to begin selecting text.
- Move the cursor using h,j,k,l,C-b,C-f or arrow keys/PGUP/PGDOWN
- Hit the space bar again to copy the selected text.
- Hit
ESCto exit scrollback mode. - Press
C-a ]to paste.
4
Comments
—
Comments feed for this post
#3 Eliot commented on 2009-05-18:
Here's a good tip I got from Joan via email. It explains how to use a screen session nested in another screen session.
Situation: I opened the screen in my local machine, and then I connected to a remote server and reattached a screen session. Do you know how can a switch to a
3 bash,4 bash, ... (blue) into the remote server? when I type: Cntrl+a a or Cntrl+a 1, 2, 3 and so on, only switches into the grey (local) screen. [0 bashand1 bash]
Joan's solution:
Use
Cntrl+a a pandCntrl+a a nto go to previous/next windows. For example, if you had 3 screens on inside other, then you would doCntrl+a a a petc.
#4 Kryksyh commented on 2010-02-01:
The another way is to tell screen to use terminal emulator buffer. To do so one should place string like that in screenrc
$ cat ~/.screenrc:
termcapinfo xterm|xterms|xs|rxvt ti@:te@
Post a comment
About
I'm Eliot and this is my notepad for programming topics such as Python, Django, Ubuntu, Emacs, etc... more »
Search Blog
Tags
-
algorithms
(4)
-
aws
(8)
-
blogproject
(20)
-
c_cplusplus
(12)
-
cardstore
(8)
-
colinux
(2)
-
concurrency
(9)
-
conkeror
(2)
-
cygwin
(18)
-
datastructures
(15)
-
datetime
(3)
-
dell
(3)
-
django
(39)
-
emacs
(20)
-
files_directories
(10)
-
install_setup
(7)
-
javascript
(3)
-
keyboard
(6)
-
matplotlib
(5)
-
mercurial
(4)
-
nginx
(2)
-
preferences
(8)
-
processes
(3)
-
pyqt
(18)
-
python
(122)
-
ratpoison
(3)
-
regexes
(5)
-
rsync
(3)
-
softwaretools
(17)
-
sql
(13)
-
ssh
(7)
-
subversion
(6)
-
twisted
(6)
-
ubuntu
(60)
-
urxvt
(5)
-
vxworks
(25)
-
webservices
(4)
-
wmii
(7)
Blogroll
- Adam Gomaa
- Alex Clemesha
- Amir Salihefendic
- Armin Ronacher
- David Beazley
- David Ziegler
- Duncan McGreggor
- Gareth Rushgrave
- Glyph Lefkowitz
- Guido van Rossum
- Ian Bicking
- Jacob Kaplan-Moss
- James Bennett
- James Tauber
- Jesper Noehr
- Matt Harrison
- Nikolay Kolev
- Parand Darugar
- Peter Baumgartner
- Peter Bengtsson
- Rob Hudson
- Simon Willison
- Will McGugan
#1 miroslav commented on 2008-11-26:
thank you