2009-12-09

 

Getting started with screen (quickly)

Screen is a wonderful tool.

I use different configuration files for different scenarios, for example I regularly work on a set of database servers and I like to group them in a config file (for example ~/screen-dbservers).

The top part of the config files contain the following:

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'


This typically displays a status line on the bottom. It's also in my ~/.screenrc file as the only two lines.

The rest of each individual file contains the servers I connect to (using SSH only in my case):

screen -t db-svr-01 1 ssh db-svr-01
screen -t db-svr-02 2 ssh db-svr-01
screen -t db-svr-03 3 ssh db-svr-01
# etc...


Looking at the first line, it's broken down in the following way:

screen => The screen command
-t db-svr-01 => A label (will be displayed in your status bar)
1 => A number for switching windows (you have 0 through 9)
ssh db-svr-01 => To which server do we SSH


You will notice I tend to keep my labels the same as the host names I'm connecting to - you may obviously prefer something else.

Now, just type:

$ screen -c config-file

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?