When I execute screen -ls
, I see the following. How can I kill all the detached sessions?
There are screens on:
84918.tty
Here's a solution that combines all the answers: Add this to your .bashrc
or .bash_profile
:
killscreens () {
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill
}
source .bashrc
to make killscreens
availableThanks to @Rose Perrone, @Milind Shah, and @schatten