Kill all detached screen sessions

前端 未结 6 1820
时光取名叫无心
时光取名叫无心 2021-01-29 20:47

When I execute screen -ls, I see the following. How can I kill all the detached sessions?

There are screens on:

    84918.tty         


        
6条回答
  •  青春惊慌失措
    2021-01-29 21:21

    Include this function in your .bash_profile:

    killd () {
        for session in $(screen -ls | grep -o '[0-9]\{4\}')
        do
            screen -S "${session}" -X quit;
        done
    }
    

    To run it, call killd. This will kill all screen sessions, detached or not.

提交回复
热议问题