Screen Cheet Sheet: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
No edit summary
No edit summary
Line 20: Line 20:
How to do other cool stuff?
How to do other cool stuff?


* windows names and titles
screen -S "myscreename"
show up when you
screen -l


* windows names and titles
* cool hardstatus lines, in your .screenrc file:
* cool hardstatus lines, in your .screenrc file:
<pre>
<pre>

Revision as of 21:41, 26 March 2010

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
screen -S "myscreename"

show up when you

screen -l
  • 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