How to take a screenshot of a Linux desktop over SSH.

Posted: July 21, 2014. At: 11:50 AM. This was 4 years ago. Post ID: 7541
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

To take a screenshot of a Linux desktop over SSH; firstly you must set the DISPLAY environment variable.

homer@deusexmachina ~ $ export DISPLAY=:0

Then use scrot to capture a screenshot of the desktop to a file.

homer@deusexmachina ~ $ scrot :0 my.jpeg

Since I am using my Windows Server 2012 laptop to connect to my Linux machine over a proxy, I installed the WinSCP application and this allows me to upload and download to my files over an SFTP connection. This provides a simple two-pane display of the local machine and remote directories.

Download this application here: If you have sessions saved in Putty, these can be imported into WinSCP.

WinSCP. A good way to copy files from a Linux machine.
WinSCP. A good way to copy files from a Linux machine.

Here is how to retrieve the file using sftp.

Administrator@WIN-EM8GK0ROU41 ~
$ scp -P 443 homer@ /home/Administrator/
LMDE MATE Editionhomer@'s password:

This is an easy way to take a screenshot of the Linux desktop and copy it to your local machine, either Windows or Linux.

And this is the screenshot that I was able to retrieve from my Linux machine to a Windows laptop. Purely using SSH.

My mwm desktop screenshot.
My mwm desktop screenshot.

No comments have been made. Use this form to start the conversation :)

Leave a Reply