At times I need to take screenshot of login screen. For example if I am writing about how to install Cinnamon in Ubuntu, a screenshot of login screen would be helpful to beginners. Whatever may be your reason, if you are wondering how to take screenshot of the login screen in Ubuntu, Linux Mint and other Linux distributions, let me show you how to do that.
Easiest but limited way of taking screenshot of login screen in Linux
The easiest way of taking screenshot of ‘lock screen’ is to utilize the GNOME Screenshot tool. This tool should already be installed in most Linux distributions. All you have to do is to open a terminal and use the command in following fashion:
gnome-screenshot -d 10
This will take a screenshot with a delay of 10 seconds. In this duration, lock your system. In 10 seconds, it will take a screenshot of your system which is at login screen. You can find the screenshot in the Pictures folder.
You can change the duration from 10 seconds to your liking.
Better but slightly complicated way of taking screenshot of login screen in Ubuntu and other Linux
The idea here is to create a script that you can run from command line interface. Don’t be scared of “the script”. It is really very simple to use it.
Step 1: Get ImageMagic
Open a terminal and use the following command to install ImageMagic.
sudo apt-get install imagemagick
Step 2: Prepare the script
Create a new file, preferably in your Home directory. Name it screenshot.sh or anything you like. Add the following lines in this file:
chvt 7; sleep 5s; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xwd -root -out ~/screenshot.xwd; convert ~/screenshot.xwd ~/screenshot.png; rm ~/screenshot.xwd
In the above, chvt 7 is the number of the virtual console. It will take a screenshot 5 seconds afer you have run this script. You can change it to any number you want. You’ll find the screenshot saved as screenshot.png in your home directory.
Step 3: Give executable permission to the script
You must give the script execution rights:
sudo chmod +x screenshot.sh
Step 4: Taking screenshot
Now when everything is ready, log out of the system. Press Ctrl+Alt+F1 at the login screen to go console mode. Login with your user credential. Run the screenshot script like this:
Once the script is run, it will take you back to login screen graphical interface (chvt 7) and after five seconds it will take and save the screenshot in your home directory with a file name screenshot.png.
You can modify the screenshot script as per your need.
I hope this tip helped you to take screenshot of the login screen in Ubuntu, Linux Mint or any other Linux distribution. Any questions or suggestions are always welcomed.