3

I have an attached screen session where I am running some jobs. I closed its terminal without detaching it because it does not respond suddently. Now by screen -ls I can see it is still attached. But I cannot reattach it without detaching it first, however detaching it takes a very long time and still is not finished yet.

  bash-3.2$ screen -ls  
  There are screens on:  
   14493.ssh2others (Attached)  
  1 Socket in /tmp/uscreens/S-tim.  

  bash-3.2$ screen -r 14493  
  There is a screen on:  
   14493.ssh2others (Attached)  
  There is no screen to be resumed matching 14493.  
  bash-3.2$ screen -d 14493  

I wonder why it takes so long and is not finished detaching yet?

Since my jobs are running in the screen session, I am afraid killing it will kill my jobs as well. So what can I do to detach and reattach it now?

Thanks!

5

In some cases, your previous screen session may not have detached properly when you lost your connection for example. If this happens, you can still detach your session manually.

To see your existing screen sessions, enter:

screen -list

To detach an attached screen, enter:

screen -D

If you have more than one attached screen, you can specify a particular screen to detach. For example:

screen -D 14493.ssh2others

Once you've done this, you can resume the screen by entering the screen -r command.

  • 4
    You can shurtcut this a little with screen -Dr (adding the screen session id or name if you have more than one running instance that this could apply to) which will detach the session and immediately reattach it to your current connection. – David Spillett Jan 12 '10 at 10:27
  • Thanks! But I tried what you said, it still get stuck there. Anyway out? Also what's the difference between -D and -d? BTW -l does not list the existing sessions but create a new session. – Tim Jan 12 '10 at 15:16
  • run "screen -?", among others you get: -D -RR Do whatever is needed to get a screen session. and -wipe Do nothing, just clean up SockDir. – slovon Jan 18 '10 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.