Screen Play

Posted on September 12, 2006
Filed Under linux | 4 Comments

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.

Comments

There is a posted comment policy for this blog. Please respect the rules.

4 Responses to “Screen Play”

    Comment Permalink
  1. Dave Hamilton on September 13th, 2006 8:24 am

    Oh… now THIS is handy. Thanks, Dave!

  2. Comment Permalink
  3. Andrew Herron on September 13th, 2006 9:22 am

    I have some weird script that puts the screen # in my window title, I prefer it there to in my prompt – but yes, very handy tip ūüėÄ

  4. Comment Permalink
  5. Ken Kennedy on September 13th, 2006 1:28 pm

    Suhweet. I didn’t have the screen part in my bashrc, and I’ve been using screen quite a bit recently transcoding stuff on my MythTV box. Excellent.

  6. Comment Permalink
  7. Lenbok on October 26th, 2006 8:52 pm

    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”