Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I "peek" at a running but detached screen? [closed]

Tags:

linux

ubuntu

I have a script that runs in the background on a detached screen but doesn't write to a log file. (screen -dmS somename somescript)

When I check on the script, I attach to it (screen -r somename) then detach when I'm done (C-a d).

Instead of attaching then detaching, is it possible to simply "peek" at what's on the screen?
Something similar to echo "$(screen -r somename)" that actually works?

like image 704
Mr. Llama Avatar asked Oct 17 '13 20:10

Mr. Llama


1 Answers

The -X option sends a command to a running screen instance:

screen -r somename -X hardcopy 

the hardcopy command writes a screen dump into hardcopy.N, where N is the index of the active screen.

like image 181
Barmar Avatar answered Oct 22 '22 12:10

Barmar