Linux (Ubuntu)
Screen: Kill a detached session
by admin on Jul.20, 2012, under Linux (Ubuntu)
I recently came across the problem, that I was unable of killing detached screen sessions for various reasons. I noticed the sessions still would shop up when entering
screen -ls
even though it wasn’t even possible to attach to these sessions and exit them appropriately. Luckily, I was able to find a working solution to get rid of these dead sessions. Sample output of screen -ls
There are screens on:
16905.pts-0.debian (07/20/2012 02:12:26 AM) (Detached)
16074.pts-3.debian (07/19/2012 11:29:40 PM) (Attached)
2 Sockets in /var/run/screen/S-root.
So let’s say I’d like to kill the session named 16905.pts-0.debian, I would simply execute the following command from a linux terminal:
screen -X -S 16905.pts-0.debian kill
In some cases this can turn out to be extremely useful.