I have a bunch of screen sessions running on my machine, but all of them are detached and unneeded. Is there a good way to just close all of them, so I have nothing when I type "screen -ls"?
+4
A:
how about
$killall screenUpdate
Just to illustrate here are the lines from my machine where I tested this:
blake ~ $ screen -ls There are screens on: 10250.pts-0.web01 (Detached) 446.pts-0.web01 (Detached) 599.pts-0.web01 (Detached) 526.pts-0.web01 (Detached) 4 Sockets in /tmp/screens/S-blake. blake ~ $ killall screen blake ~ $ screen -ls No Sockets found in /tmp/screens/S-blake.
I don't think that will do anything to detached sessions.
Dennis Williamson
2009-09-01 17:33:12
Actually it will. I just tested it on my machine and it wiped them all out
2009-09-01 17:35:28
You're right.
Dennis Williamson
2009-09-01 17:38:59
Thank you sir...
2009-09-01 17:40:06
wow! I never would have guessed this. thanks!
2009-09-01 17:42:37
np ;-) We've all been there at some point in time (Me more than most!)
2009-09-01 17:43:47
You might want to use the `-u` option, though, to restrict the `killall` to just the user you intend, although if you aren't `su` or using `sudo` it won't let you kill another user's sessions. By the way, I had to do `killall screen.real`
Dennis Williamson
2009-09-01 17:47:50