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?
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?
"kill" will only kill one screen window. To "kill" the complete session, use quit
.
I usually just use "screen -d [session #]" to get rid of a detached screen. After that you can resume your session "screen -r"
You can kill a detached session which is not responding within the screen session by doing the following.
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.
get attached to the detached screen session eg: screen -r 20751.Melvin_Peter_V42
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)
Thats its your remote screen session will be terminated now.
Hope this helps.
== 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.
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.
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