How To Take A Screenshot of Login Screen in Ubuntu

Getting the screenshot of your screen is as simple as hitting the Print Screen [PrtSc] key on your keyboard and then allowing the Screenshot Tool to take control, or in case of Windows OS, allowing it to be copied to the clipboard and then using it in any program of of your choice, but how to take a screenshot of login screen in ubuntu? Here’s how to do it.

You’ll need the Virtual Terminal number and a short script which we’ll discuss just now.
 

1. Find out the Virtual Terminal (vt) number of your login screen.

 
To know your vt number, logout of your desktop session. This is to get to your login screen. When on the login screen hit the CTRL+ALT+F1 keys to get to the command prompt. Now you need to get out of this. Yes, without logging in or doing anything on the command prompt, just get back to the graphical login screen using CTRL+ALT+F7. In my case it was CTRL+ALT+F7, but it can be CTRL+ALT+F8 for you. Just try it. If these two Function keys don’t work, try with other Function keys (F1-F8). The number you get here, or rather the function key using which you manage to get back to the GUI Login screen is your Virtual Terminal (vt) number.
 

2. The screenshot part.

 
Now login to your system and install imagemagick and xnest. You can use this command to do so in Ubuntu:


Once installed, switch to your home directory and create a script, you can name it anything like screenshot.sh


Now type-in this script in the file [Remember to change your vt number (chvt) to what you found out in step 1]:
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

Use CTRL+X to exit and save changes when prompted.

Make the file executable:


Screenshot of Login Screen in Ubuntu



Logout of your system. Press Ctrl+Alt+F1 to go to the console (tty1) and login using your system username and password. Gain sudo priveleges:


And then call the script:


This will switch to your login screen (GUI) automatically and take a screenshot. Log into your desktop and open the file manager. You should find your login screenshot in /home/[username]/screenshot.png.


 

Hope you liked this post and found it useful!
If you did, share it with your friends & family.

And why not shower some of your love and use our affiliate links when you shop online!

Share Your Thoughts Here.....