Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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'd like to export the content of a detached screen under linux. I tried those command:

screen -x 2>&1 > temp
screen -x > temp 2>&1
screen -x > temp

But it's not working, It keeps reattaching to a session instead of exporting it in the "temp" file.

Screen version: 4.00.03jw4

What do I do wrong?

share|improve this question
up vote 6 down vote accepted

You probably want to do something like:

screen -p 0 -X hardcopy

this generates a file hardcopy.0 with the content of the screen session. The argument to -p determines which session.

The files are dumped in screens current working directory or to the directory set set with the hardcopydir command. Check the screen configuration file for hardcopydir (/etc/screenrc).

share|improve this answer
Hi, thanks for your answer! I can't find the hardcopy file. – Thaldath Dec 13 '13 at 10:21
it should be in the directory that you run the command in. Please check your write permissions there and post the version of screen you use (output of screen -v preferably in the question) – Anthon Dec 13 '13 at 10:27
Screen version: 4.00.03jw4 I've got full r/w permission. – Thaldath Dec 13 '13 at 10:37
That is the same version I have, did you cut and paste the command? Run it in a different terminal than the running screen session. Any message from running the command? – Anthon Dec 13 '13 at 10:51
yep, I used the same command. But there is a program running in the screen, I don't know if this change anything or not? – Thaldath Dec 13 '13 at 13:31

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.