Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am tying to learn gnu screen. I am using mac(snow leopard). I am running 4.00.03 version of screen.

I am starting a new screen with following command

screen -S foo

However after that if I do ctrl + A + " then I see the list of screens. However all the lists have numbers and then bash. Because all it says is 'bash' I can't figure out which screen has what. Am I missing something?

share|improve this question

You're missing the difference between a screen session and a screen window.

Screen sessions are a bit like GUI desktops. They can contain a number of windows; each window can run a separate program. The screen session is like a container for windows.

Ctrl-A " shows you the window list. Matrix Mole's answer shows how to name your windows; you already know how to name your sessions (with screen -S foo). To see the list of sessions, use screen -list:

$ screen -S foo
# let screen start, then use Ctrl+A D to detach

$ screen -S bar

$ screen -list
There are screens on:       (05/05/2010 05:00:34 AM)        (Detached)       (05/05/2010 05:00:26 AM)        (Detached)
2 Sockets in /var/run/screen/S-quack.

Now you can reattach to one of the existing sessions with screen -r foo, do some stuff, detach, reattach to the other session with screen -r bar, do some other stuff, etc.

share|improve this answer

The names of the screen windows default to the name of the program bring run in them (bash most of the time). To rename a particular window you need to use Ctrl-A A and it will let you rename the window you're currently in. This will help you to know which window is which when you use Ctrl-A ". Also, if you have a .screenrc file in your home directory, you can configure screen windows to default to certain window numbers along with specific names. Below is the portion of my screenrc file that configures my startup windows on my linux machine:

screen -t root          0 sudo su -
screen -t shell         1
screen -t nntp          2
screen -t decode        3
screen -t IRC           4 /usr/bin/irssi
screen -t Vim           5
screen -t torrents      6 /usr/bin/rtorrent
screen -t jabber        7 /usr/bin/mcabber
select 0

The items after the -t are the names of the windows, the numbers are for the position in the window list, and what's after the number is a program to execute in that window. If a program is closed that was started with the window, that window will be closed as well. SO if I close out of irssi completely, then window 4 will be closed, and the next time I create a new window (with Ctrl-A A) I'll get that new window as window 4.

Most of what I've learned about configuring screen has come from reading the default .screenrc file. There should be one on the mac somewhere, but I'm not sure where it is stashed.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .