views:

296

answers:

2

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 screen
Update

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
Actually it will. I just tested it on my machine and it wiped them all out
You're right.
Dennis Williamson
Thank you sir...
wow! I never would have guessed this. thanks!
np ;-) We've all been there at some point in time (Me more than most!)
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
A: 

Had to use $ killall SCREEN for this to work.