Is there a single command for screen to completely close/quit all running programs in detached mode?

I hope to do this in a bash script without any further input.


You can use screen -X to send a command to a running screen, so screen -X quit should ask the session to terminate and kill all of its windows.

If you have multiple screens running, use -S to identify them.

  • It is intended to be used in a bash script rather than terminal input. I edited the question. – Googlebot May 2 '17 at 23:54
  • @All, I'm not sure what the issue is there, screen -X quit -S $sessionname will still ask a running screen session to quit, regardless of if the command is given from an interactive shell, or a script. Do you mean you have multiple screen sessions running, and want to close them all? – ilkkachu May 3 '17 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.