GNU Screen Config

GNU Screen Config

Note: This post is archived. I now use tmux (and many distros ship nice screen configs now).

Over the last few years using screen I have stolen bits and pieces from other screen configuration files. Recently, I found the one below, which is very useful and works well.

The configuration below should be put in your ~/.screenrc file. The bindkey lines will set Alt-, and Alt-. (the same keys as < and > on a QWERTY keyboard) to move between windows left and right.

# Look and feel
caption always "%{= bb}%{+b w}Screen: %n | %h %=%t %c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"

# Our warning of activity
activity "Activity in %t(%n)"

# Left Right meta key mods
#ALT-,. and ALT-<>
bindkey "^[<" eval number !echo $WINDOW-1|bc
bindkey "^[>" eval number !echo $WINDOW+1|bc
bindkey "^[," prev
bindkey "^[." next

To activate the caption output, the following should added to your ~/.bashrc file also:

# Change the window title of X terminals
case $TERM in
    PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'

With the above activated in your ~/.bashrc (don’t forget to restart screen!), you should notice directory and process information appear just above the window tabs.

David Cannings
Cyber Security Geek

My interests include computer security, digital electronics and writing tools to help analysis of cyber attacks.