Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a script to close screen session

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"?

like image 507
user143879 Avatar asked Sep 01 '09 17:09

user143879


People also ask

How do I force a screen session to detach?

To start a screen session, you simply type screen within your ssh session. You then start your long-running process, type Ctrl+A Ctrl+D to detach from the session and screen -r to reattach when the time is right.


1 Answers

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.
like image 57
bsisco Avatar answered Sep 27 '22 22:09

bsisco