Taking a screenshot of screen session over ssh

3

I often log via ssh to servers just to execute screen -r and look at my irssi irc session. Then I do Ctrl-AD and logout.

Is there a nice solution to wrap this into a script, so that I get to see the snapshot of my screen session in any format (graphical, or text)?

qwerty

Posted 2013-02-25T20:55:20.287

Reputation: 33

Answers

3

You can get a "screenshot" of a screen session like this:

screen -p0 -X hardcopy hardcopy.txt

So this will take a hardcopy of whatever is in the first window (-p0) and put it in a file called hardcopy.txt (if you leave off the filename, it will use hardcopy.n where n starts at zero an increments each time.

The screenshot is on the remote machine, and I guess you want to view it. Perhaps something like:

ssh user@remote 'screen -p0 -X hardcopy hardcopy.txt; cat hardcopy.txt'

You could also log your irssi session, so the following would work:

ssh user@remote 'tail -50 /path/to/irssi/log'

If you want a screenshot that maintains colors, then that would depend a bit on the OS and desktop environment you sshing from.

Paul

Posted 2013-02-25T20:55:20.287

Reputation: 52 173