This article is about GNU Screen – you can read about GNU Screen here: http://www.gnu.org/software/screen/
There may be times when you have multiple, or even a single, screen session which you want to kill without attaching to it and ending it as you normally would.
You can kill a screen session using the session ID or the name (if the name is unique enough).
Warning: Both ways end all processes within the screen session, so if you have any open files/applications, make sure you don’t need/want them – they’ll be kill’d along with the session.
Killing by session ID
First, run screen -list to get the id of the current sessions (we use the id to kill the screen session)
daz@scampi:~$ screen -list There are screens on: 11493.irssi (04/01/10 16:25:44) (Detached) 30784.newapps (01/01/10 19:42:38) (Detached)
As you can see in this example, I have two sessions, a session called “irssi” with id 11493, and a session called “newapps”, with an id of 30784.
So, to kill the “newapps” session, I’d run:
daz@scampi:~$ screen -X -S 30784 kill daz@scampi:~$
.. and the session will now be gone. You can verify that by running screen -list again.
Killing by session name
If your screen session name is unique enough (for example, if you have one called “newapps” and another called “irssi” as per my example) you can kill by name:
daz@scampi:~$ screen -X -S newapps kill daz@scampi:~$
The reason I say unique enough – if you have a session called “newapps” and one called “newapps1”, you will need to use the ID to end “newapps” before “newapps1” – you’ll simply be asked to specify the session again otherwise.
thanks, I had a screen session that was hung, and this was very helpful!
Comments are closed.