GNU screen configuration

Home | UNIX | Oracle | Code | Practical | Private

GNU screen configuration


Introduction
GUN Screen is somehow a terminal window manager.
Ref. www.gnu.org/software/screen/


Installation
Either install it through your distribution's package system, or from source if the package isn't available (like for FreeBSD),
wget ftp.gnu.org/gnu/screen/screen-4.0.3.tar.gz
tar xvzf screen-*.tar.gz
cd screen-*/
./configure --prefix=/usr/local
make
make install
Note. "--prefix" is mandatory here

Add the screen related termcaps,
cat terminfo/screencap >> /etc/termcap

Make the configuration rapidly available,
cd /etc
ln -s ../usr/local/etc/screenrc


GNU screen Configuration
Configure screen,
cd /etc
mv screenrc screenrc.dist
vi screenrc
copy/paste,
startup_message off
caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< %{=b BW} %H %{-} %l %c %d/%m/%Y"
bindkey ^[, prev
bindkey ^[; next
shelltitle ""
autodetach on
defscrollback 65000
#screen -t "log" 0 tail -F /var/log/messages
#screen -t "errors" 1 sh -c "tail -F /var/log/httpd/*error*.log"
Ref. pbraun.nethence.com/code/misc/screenrc.html
Note. to find out the right keys do bind, just do "cat" in your terminal and type the keys, then "^C".
Note. a similar caption example can be found into screen's manual,
man screen > search for "FLOW-CONTROL" Section. A few lines above you will find the "caption always" examples. Copy/paste the before-last one to /etc/screenrc (with e.g. gpm or putty).

Then root or some admin user,
cd ~/
vi .screenrc
like,
screen -t "log" 0 tail -F /var/log/messages
#screen -t "errors" 1 sh -c "tail -F /var/log/httpd/*error*.log"

If screen windows don't load .profile nor .kshrc, add
shell -/bin/ksh
Note. the '-' prefix is for login shell, like '-l'


Usage
Attach the first detached session it finds,
screen -R
remotely detach and attach locally,
screen -rd

For UTF-8 terminals,
screen -U

To create a new window,
^A c
To switch back to the last used window,
^A a  revenir à la dernière fenetre
To switch to another window,
^A <window number>
Note you can use keybindings see the bindkey stuff above.
To move a window,
^A :number 2
To reload screenrc,
^A :source /etc/screenrc
To split the screen,
^A S
To switch to the other part,
^A TAB
To delete all regions but the current one,
^A Q

screen inside screen ?
:escape ^Tt


Alternative
Alternatively, use splitvt (www.devolution.com/~slouken/projects/splitvt/),
cd ~/
vi .splitvtrc
like,
#set command_char ^O
#set quote_char ^V
#set switch_char ^W
#set upper_lines 12
run -upper /usr/bin/tail -F /var/log/thttpd.log
run -lower /usr/bin/tail -F /var/log/messages
#set login on
# This next line would override the 'run' statements above
#run /bin/ksh


Additional notes
Irssi configuration : pbraun.nethence.com/doc/chat/irssi.html
Cygwin GUN screen : web.gccaz.edu/~medgar/screen.html


Home | UNIX | Oracle | Code | Practical | Private | Donate | Print | html/css
© 2010 Pierre-Philipp Braun