Screen Play

For the longest time, this is always one of the first things I do when I set up an account on a Unix box on which I will ever be running screen.

I add this to my .bashrc file:

# Change the prompt if screen is active
if [ "$WINDOW" != "" ]; then
PS1="S:$WINDOW \u@\h \W> "
else
PS1="\t \u@\h \W> "
fi

That gives you a nice prompt like this:

S:9 dave@nexus dave>

when you are in screen, where the S:9 says that this is screen window #9. Man does this make life simpler some days.

4 Replies to “Screen Play”

  1. Nice, but it doesn’t seem to be updated if you swap window orders, e.g.:

    :number 3

    I go for having the screen number in the window title, using something like this in my screenrc:

    termcapinfo xterm ‘hs:ts=\E]2;:fs=07:ds=\E]2;screen07’
    hardstatus string “[screen %n%?: %t%?] %h”

Comments are closed.