Taking screenshots in Debian is very easy. You will definitely know how to use the built-in screenshot utility or the PrtScr key on your keyboard to take a screenshot of your system. There are other open source screen capture utilities that allow you to take screenshots of your system, but they are not. But what about taking a screenshot of the lock screen or the Debian login screen? Regardless of the reason why you need a screenshot of the lock screen or the login screen, we’ll show you how to achieve it.
This article is dedicated to discussing the ways in which you can take a screenshot of the lock screen and login screen.
We have followed the steps and procedures mentioned in this article on a Debian 10 system.
Method # 1 Using the Screenshot Utility
Take a screenshot of the lock screen
In the next method, we will discuss taking a screenshot of the lock screen and login screen using the built-in screenshot utility. To open the screenshot utility, press the superkey on your keyboard and enter screenshot in the search bar. When the result appears, click on the utility to open it.
When the utility opens, change the value Capture after delay up to 6 seconds. Then press the button Take a screenshot button.
Now lock your system using the system menu or the Super + L keyboard shortcut. Wait a few seconds until your lock screen is locked by the screenshot tool.
Then unlock the screen and you will see the screenshot utility asking you to save the screenshot. Enter a name for the screenshot and select a directory to save the screenshot to the desired location. Then press the button Save button.
Taking a screenshot of the login screen
Open the Screenshot utility in the same way as described above. When the utility opens, change the value Capture after delay almost 10 seconds or more. Then lock the system using the system menu or the Super + L keyboard shortcut.
Now try to unlock your system by swiping your finger across the screen within the above time range, for example, in our case, it is 10 seconds. When you swipe up the screen, the login screen will appear, and within a certain range of 10 seconds, it will be captured by the screenshot utility.
After the screenshot is taken, enter the password to login. After logging in, you will see a screenshot utility asking you to save the screenshot. Enter a name and select a directory to save the screenshot.
Method # 2 Using the ImageMagick utility
In the next method, we will use the ImageMagick utility to take a screenshot of our login screen. Please note that this utility will only take a screenshot of the login screen, not the lock screen. To complete this method, we will use the Terminal Command Line application.
Open a terminal by going into actions in the upper left corner of your desktop. Then use the search bar to find the Terminal application. When the result appears, click Terminal to open it.
Now run the following command in Terminal if you don’t have ImageMagick installed.
$ sudo apt-get install imagemagick
Now we need to create a script that will allow ImageMagick to capture the screen after 10 seconds of running the script. Create a script named screenshot-login using the following command in Terminal.
$ sudo nano screenshot-login.sh
Now copy and paste the following lines into a script file named screenshot-login.sh:
chvt 7; sleep 10s; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xwd -root -out ~/loginscreen.xwd; convert ~/loginscreen.xwd ~/loginscreen.png; rm ~/loginscreen.xwd
After that use Ctrl + O to save and Ctrl + X to close the editor.
If you are using gdm3 display you will need to switch to lightdm display in order to run the script. First install lightdm display by running the following command in Terminal:
$ sudo apt-get install lightdm
Then run the following command to switch to lightdm display:
$ sudo dpkg-reconfigure lightdm
To revert to gdm3 display, you can use the same command, replacing lightdm with gdm3.
Now run the following command in Terminal to make the script executable:
$ sudo chmod +x screenshot-login.sh
Now reboot your system and press Ctrl + Alt + F1 at the login screen to enter console mode. Enter your username and password to login, and then run the following command:
$ sudo ./screencapture.sh
After running the script, you will be returned to the login screen. Wait 10 seconds as defined in the script, after which a screenshot of the login screen will be saved in your home directory.
In this article, we learned how to take a seemingly impossible screenshot of the lock screen and login screen on a Debian system using the built-in screenshot tool and bash script.
How to take screenshots on Debian Linux