.screenrc example

This is an example .screenrc file that I use with AIX specifically. It’s very basic and just allows me to see the open windows, titles and active window.

startup_message off
hardstatus on
hardstatus alwayslastline
hardstatus string "%{wk}%W %{Gk}[%n - %t]%{wk}"

I do prefer tmux, but sometimes I only have screen available.

I combine this with a connection script that issues the following to set the window title:

echo -n -e "\033k${server}\033\\"

Where ${server} is the variable in my connection script that contains the name of the server it is connecting to.

If there is a problem on AIX when running screen that means the backspace key doesn’t work, it may be due to the “set -o vi” not being run by the shell. To partially fix this, add the following to the users’ .profile:

set -o vi
alias sc="screen -T vt100 shell -/usr/bin/ksh"

Now re-load the file with:

. .profile

Now add the following to the .screenrc:

bindkey -d ^? stuff ^H
bindkey -d ^@ stuff ^H

Start screen with the alias sc instead of the screen command itself.

…and your backspace along with the usual ESC-k commands should now work, however you may need to run set -o vi in any new screens you create. I’m still trying to find out how to fix the last bit.

Update : Just started using screen with Cygwin for a client. Here is my .screenrc for this setup…

startup_message off
hardstatus on
hardstatus alwayslastline "%1`"
hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w"
term vt220
defscrollback 10000
screen -t NIS ./c nis
screen -t gimp001a ./c gimp001a
screen -t DNS ./c dns
focus down
screen -t local bash
bindkey -t tpath stuff "lspath | grep -v Ena |wc -l^M"
bindkey -t tether stuff "lsdev -Ccadapter|grep EtherC | awk '{print \$1}'|while \
   read dev^Jdo ^Jecho \"\$dev : `entstat -d \$dev | grep -i act`\"^Jdone^M"
bindkey -t tvio stuff "echo \"cvai\"|kdb|grep vscsi^M"
bindkey -t tmac stuff "netstat -ia|grep en| awk '{print \$1 \"\\t\" \$4}'^M"
bindkey -t tsap stuff "/gio/home/miac0203/pub/scripts/getsap.ksh"
bindkey -t texit at "#" stuff "exit^M"
bindkey -t tuser stuff "/usr/local/script/lsauth.pl"
bindkey -t thome stuff "/gio/home/trmu2602/mkhome.sh"


I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

%d bloggers like this: