Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a screen named 'foo' that I started using the command

screen -S foo -d -m  my_command_goes_here.

I want to put this in cron, and restart it nightly by killing the screen. The reason I'm using a screen is my command starts up several other procs and this will ensure they all exit.

So... what is the command to kill sceen 'foo'?


share|improve this question
What commands are you running that you require screen to have them properly exit? – Darren Hall Feb 22 '10 at 19:47

screen -S foo -X quit

From the man page:

-X  Send the specified command to a running screen session.
quit    Kill all windows and terminate screen.
share|improve this answer

Try using this:

screen -S foo -X kill

I would be cautious tho, depending on what you're running and the state that it's in, this may not kill the processes running in screen, and maybe cause file system instability if it has any files open (i don't know for sure, i'm just assuming)

share|improve this answer
unfortunately this didn't work. – Poul Feb 22 '10 at 19:01
worked for me, was on ubuntu. But I only had one window open in screen. Should have done more testing. – Roy Rico Feb 22 '10 at 19:47
only reason why I can't see this working is if you have more than 1 screen session named foo, use screen -list to get a list of current running sessions. – Darren Hall Feb 22 '10 at 19:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .