Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 can't seem to find anything on this so, is there a way to pipe everything from a screen window into another command. I have a server running in screen (not the best idea, but the only way for the server atm), and want to parse the output (while it is running, is it possible to take everything printed to that detached screen into another command?

Thanks, Max

share|improve this question
Consider restarting the server and piping its output through tee. – Daniel Beck Jun 7 '11 at 5:34
up vote 1 down vote accepted

If you need to log output of a running screen session, do the following:

  1. Attach to the session.

  2. Press your Prefix key (Ctrl+A on an unchanged setup), then :, enter logfile <filename>.

  3. Again Prefix :, enter logfile flush <interval in seconds>.

  4. Prefix :, enter log on.

screen will now log all output to the file <filename>, every <interval> seconds. You can tail -f that file to process the output.

You can skip steps 2 to 4 and just press Prefix, then H. The defaults will be screenlog.n for <filename> and 10 seconds for <interval>.

Note that the file can grow quite large if you have a lot of output to handle.

share|improve this answer

Something like this perhaps:

$ screen -d -m sh -c "/path/to/my/exec | tee output.log" 
share|improve this answer
Would this output as the server is running? Or only after the server is restarted? Sorry, can't really test on a live server (restarts aren't great on a game server), and don't want to duplicate the environment if I don't need to. – Ben Jun 7 '11 at 22:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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