1

After doing

screen -S foo
screen -S bar
screen -ls

I see two screens: 1234.foo and 5678.bar (both Attached).

How can they be both attached, as I'm only in one at a time? (Presumably the last one I started?) Perhaps I misunderstand the concept, what does 'Attached' or 'Detached' mean?

Now, when I press: Ctrl+A " to get a list of screens, I only see ONE entry: 0 bash.

Perhaps I misunderstand this concept as well, shouldn't there be two screens?

When I do screen -ls it still shows two screens, both still Attached. How do I know which one I'm currently in?

  • Related: https://askubuntu.com/questions/980910/how-do-i-start-screen-with-multiple-splits-directly-from-the-command-line ? – Videonauth Dec 03 '17 at 01:45
  • @Videonauth Thanks, but what does 'attached' or 'detached from your current screen session' mean, exactly? I would assume I'm working on one screen at a time, so I'm attached to that one, and the rest is detached. But in my example above, they are both attached even though I am in only one of them at a time? (I'm not using split screen layout or anything) – RocketNuts Dec 03 '17 at 11:04
  • 1
    @Videonauth Also, would you know why Cltr+A " shows only one entry (0 bash) even though I have two sessions? And can I see in which one I am currently working? For example if I named them "foo" and "bar", can I see if I'm currently in the foo or bar session? – RocketNuts Dec 03 '17 at 11:06
  • @Videonauth Sorry maybe I'm just missing a trivial point here, put exactly what does "attached to you" or "associated with you" mean in this context? If I start a screen session, start some process there, detach from it, and then kill my ssh, the process keeps running (I understand this is the purpose of screen). However if I don't detach, if I'm actively in the screen session (or reattached to it) and then kill my ssh, the process still keeps running: if I reconnect and do screen -list they are both there, including the one I was just attached to when killing my the ssh connection. – RocketNuts Dec 03 '17 at 11:56
  • By the way, screen -list shows both sessions: 1234.foo and 5678.bar, both Attached. I can't seem to find a way to tell in which I am currently (or perhaps in neither). – RocketNuts Dec 03 '17 at 11:57
  • $ echo $STY will show you the PID and session name (if you started with screen -S. It will be empty if you're not attached. – Steven P Jan 15 '24 at 04:22

0 Answers0