How to take screenshot of login page in Ubuntu

Last Updated on April 18, 2021 by admin

Capturing screenshots is one of the most basic tasks. On Ubuntu, it's super easy - just press the 'Print Screen' key on your keyboard. There are also several third-party tools (both command line-based and graphical) available that let you take screenshots.

Sadly, none of these work if you want to capture the login screen. If you're looking for a way to take a screenshot of your login screen, you'll be glad to know that we'll be discussing one solution in this tutorial. But before we do that, it's worth mentioning that all steps/instructions mentioned here have been tested on Ubuntu 16.04LTS.

Take screenshot of Ubuntu login screen

Here are the steps that you need to follow in order to take login page screenshots:

Firstly, you need to have the ImageMagik tool installed on your system. If not already, you can get the tool installed using the following command:

sudo apt-get install imagemagick

Once the tool is there, run the following command that creates a script which will help you capture screenshots:

echo 'sleep 30; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root' > /tmp/

Make sure the script contains executable privileges. In case not, you can do this by running the following command:

chmod +x /tmp/

Now, log in the text mode, something which you can do by pressing Ctrl+Alt+F1. Once there, run the following command:

sudo bash /tmp/ >/tmp/loginscreenshot.xwd

Now, press Ctrl+Alt+F7 to come back. Next, log out of the current session so that the log-in screen arrives. Wait for a few seconds (20-25), and then log-in normally.

The loginscreenshot.xwd file created by the last command is your screenshot, but you'll have to convert it into PNG (or JPG) format. For this, run the following command:

convert /tmp/shot.xwd /tmp/shot.png

That's it. Now you can double click on the png (or jpg) file to view it.


Note: The convert tool is part of the imagemagik package, so you don't have to install it separately.

Via 1 2

Leave a Comment