Screen Cheet Sheet

From Federal Burro of Information
Revision as of 13:14, 16 January 2009 by David (talk | contribs) (New page: first thing's first: man screen * [http://www.linuxjournal.com/article/6340 A good essay on screen usage] * [http://aperiodic.net/screen/multiuser Good info on multiuser screen] Do yo...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

first thing's first:

man screen

Do you have cool screen tricks?

move control-a to control-w with an alias, in bash, like this:

alias screen='screen -e ^Wa'

why would i want to do that? control-a means beginning of line by default. If you make screen's mate control-a you not longer have a "beginning of line" control sequence.

  • good external page with some info here [1]

How to do other cool stuff?


  • windows names and titles
  • cool hardstatus lines, in your .screenrc file:
hardstatus alwayslastline
hardstatus string "%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m/%d %{W}%c %{g}]"
  • scroll back, in your .screenrc file:
termcapinfo xterm 'bc@:bs@'

useful key sequences

  • meta-escape - pageup, pagedn to scroll back in the screen buffer ( you can use arrow keys and page up page down to scroll around)
  • meta-space - next window
  • meta-backspace - backwards through windows.
  • meta-meta - previous window
  • meta-A - allows you to rename a screen (if you can find a way to rename screens dynamically based on hostname, post it here for a chance to win a mars bar!)
  • meta-" - allows you to select a screen by name.
  • meta-' - allows you to select a screen by number.

Screen and ssh-agent2

This process will only work with ssh-agent forwarding.

Make sure you have a screenrc file in your home directory. If not copy the default.

cp /etc/screenrc ~/.screenrc

Now add the following line to ~/.screenrc and make sure ~/tmp exist.

setenv SSH2_AUTH_SOCK $HOME/tmp/socket

Next step is to add the following to .bashrc

if [ -S $HOME/tmp/socket ]; then
        echo "ssh-agent2 socket already exist"
else
        /bin/rm $HOME/tmp/socket
        ln -s $SSH2_AUTH_SOCK $HOME/tmp/socket
fi