Search code examples
linuxcentosgnu-screen

Kill attached screen session with numbers as session name


I have this session for example 7540.27535 (Detached) and the 27535 is the session name, so it's not the id but the session name.

What I want is to kill the sessions with the name 27535, How can I do that ?

I have multiple sessions with the same name but I also have another ones and I don't want to kill them all with killall screen. The command I am using screen -S 27535 -X quit and the answer I get from the server is

No screen session found.

Solution

  • I found the answer.

    screen -ls | grep 27535  | cut -d. -f1 | awk '{print $1}' | xargs kill