How to take screenshot of login screen in Ubuntu 15.10, Ubuntu 15.04 and Ubuntu 14.04. Terminal commands to capture screenshot of the LightDM Login Screen in Ubuntu 15.10, Ubuntu 15.04 and Ubuntu 14.04. You must have ImageMagick installed on your system to take screenshot of the Ubuntu login screen.
ImageMagick is a powerful software program to create, edit, compose, or convert images. It supports a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. ImageMagick can be used to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
To install ImageMagick, run the following command in terminal.
sudo apt-get update
sudo apt-get install imagemagick
Once installed, it’s time to create the script to take screenshot. Create a new text file, name it screenshot.sh. Create the screenshot text file in your Home directory and add the following lines in the 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
Once you have created the screenshot scrip, run the following command to give executable permission to the script.
sudo chmod +x screenshot.sh
How to Take Screenshot of Ubuntu Login Screen
Once everything is OK, here’s how to take the screenshot.
1. Log out of the system.
2. Press Ctrl+Alt+F1 at the login screen to go to console mode.
3. Login to the console mode, enter your username and password.
4. Run the command to run the screenshot.sh script:
sudo ./screenshot.sh
5. Once you run the script, you will be returned back to the graphical interface login screen. Wait gere for 5 seconds (remember sleep 5s in the screenshot script code) and after five seconds it will take and save the screenshot in your home directory.
Once the script is run, it will take the screenshot. After the screenshot is taken, you will be returned back to the graphical interface login screen. The screenshot is saved as screenshot.png in the home directory.