views:

1654

answers:

6

I learned from somewhere a detached screen can be killed by

screen -X -S [session # you want to kill] kill

where [session # you want to kill] can be gotten from

screen -ls .

But this doesn't work. Anything wrong? What's the correct way?

+3  A: 

"kill" will only kill one screen window. To "kill" the complete session, use quit.

innaM
A: 

I usually just use "screen -d [session #]" to get rid of a detached screen. After that you can resume your session "screen -r"

Thomas
+4  A: 

You can kill a detached session which is not responding within the screen session by doing the following.

  1. type "screen -list" to identify the (detached) screen session. eg: screen -list There are screens on: 20751.Melvin_Peter_V42 (Detached) Note: "20751.Melvin_Peter_V42" is your session id.

  2. get attached to the detached screen session eg: screen -r 20751.Melvin_Peter_V42

  3. Once connected to the session which might or might not respond, do the following. press "Ctrl + a" (there wont be any changes in your window now) type ":quit" ( its a colon[:] followed quit)

  4. Thats its your remote screen session will be terminated now.

  5. Hope this helps.

Melvin Peter
A: 
== ISSUE THIS COMMAND
[xxx@devxxx ~]$ screen -ls


== SCREEN RESPONDS
There are screens on:
        23487.pts-0.devxxx      (Detached)
        26727.pts-0.devxxx      (Attached)
2 Sockets in /tmp/uscreens/S-xxx.


== NOW KILL THE ONE YOU DONT WANT
[xxx@devxxx ~]$ screen -X -S 23487.pts-0.devxxx kill


== WANT PROOF?
[xxx@devxxx ~]$ screen -ls
There is a screen on:
        26727.pts-0.devxxx      (Attached)
1 Socket in /tmp/uscreens/S-xxx.
duggi
A: 

above works but it doesnt work if you have a single process running it still wont let you delete / kill a single process by session name.

nomis23uk
A: 

It's easier to kill a session, when some meaningful name is given:

//Creation:
screen -S some_name proc
// Kill detached session
screen -S some_name -X quit
Hitman_99