Screen: Kill a detached session

by 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.

Leave a Reply


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!