Jimmix
Jimmix

Reputation: 6536

Linux Terminal Screen CLI command for terminate (close) all sessions with their windows

Is there any way to terminate all Sessions of the screen linux CLI tool ?

If I list them by

screen -ls

I get:

There are screens on:
    31152.test  (08.10.2019 10:22:30)   (Detached)
    14361.pts-1.edd (08.10.2019 09:57:35)   (Attached)
2 Sockets in /run/screen/S-edd.

If I'm not wrong there used to work this command:

screen -X quit

for terminating all sessions but now it complains about not providing it with the session name:

There are several suitable screens on:
    31152.test  (08.10.2019 10:22:31)   (Detached)
    14361.pts-1.edd (08.10.2019 09:57:36)   (Attached)
Use -S to specify a session.

I'm using Screen version 4.06.02 (GNU) 23-Oct-17

Upvotes: 0

Views: 458

Answers (1)

Jimmix
Jimmix

Reputation: 6536

Got all sessions terminated by this line:

screen -ls | head -n-1 | tail -n +2 | cut -d'(' -f1 | cut -f2 -d$'\t' | sed "s/$/ quit/g" | sed "s/^/screen -X -S /g" | sh

But still I'm missing a simple option to terminate all sesions...

Upvotes: 2

Related Questions