Take Screenshot By Command or Terminal in Linux Based Machine

Taking screenshot is now a days very important. This is used for many purpose like writing blog post, sharing problem facing in the system and much more things. There are many tools to take shot of your desktop but here i will show you how to take screenshot by terminal or command line interface in linux based machine.

Let, you want to take screenshot of full screen. Then copy below command and run in your terminal.

sleep 2; xwd -root | convert - capture.png

Above , sleep 2 is just asking the command to wait 2 seconds. And capture.png is the screenshot file. This file will be created on the default folder.This command will capture full screen including the terminal you are using to take the shot.See the shot.

tms1You can click the big window to hide the terminal which you are using to take the screenshot.

tms2Now if you want to take the screenshot of a particular window. Use below code.

xwd | convert - capture.png

Above command will show you a “+” icon and this will actually ask you to select the window. But if you chose the window below the terminal you are using for taking the shot will include the shadow of that window.

tms3But you can take time take the window in the front.

sleep 2;xwd | convert - capture.png

Above command will give you 2 second time to take the window to the front and then will show the “+” icon to select that window.


That is all for today. I have used LXDE version of Debian Wheezy in Virtualbox. This commands works with XORG. Let me know if it doesn’t work for you. Thank You for reading.