Skip to content
Advertisement

Linux screen snapshot/redirect

Is it possible to take a “snapshot” of a running screen command, either stored as text or an image? Something akin to the following:

screen -S myscreen -d -m ...
screen-screenshot myscreen > output.1 # does this exist?
screen-screenshot myscreen > output.2
...

Advertisement

Answer

It’s possible to take so called “hard copy” of a screen session:

screen -X -S 11534.test hardcopy hc.n

Here we send hardcopy hc.n command to screen session 11534.test. The session name is available in the list of sessions(screen -ls).

The hardcopy command writes currently displayed image to the file(particularly, hc.n). The file is viewable via pagers(less, more, etc.) and text editors.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement