Larry Ewing's Penguin Two Penguins Larry Ewing's Penguin

How to take a screenshot on Linux

Step One Use XWD to capture an image

This utility comes with X, and means "X Window Dump". The default command gives you a special crosshairs cursor. Click with it on the window you want to capture.

$ xwd > filename.xwd

For a full-screen capture, do:

$ xwd -root > filename.xwd

To give yourself five seconds to get the terminal window out of the way before the picture, do:

$ sleep 5; xwd -root > filename.xwd

(You should hear a beep when the "photo" is taken.)

Step Two Convert to a useful format with mogrify

This utility comes in the ImageMagick package on Fedora and Ubuntu. Use the extension for the format you want, such as one of these:

$ mogrify -format jpg filename.xwd

$ mogrify -format png filename.xwd

These commands will create a file named filename.jpg or filename.png.

Step Three View your image with Eye of Gnome

View the file with eog which is probably installed already:

$ eog filename.jpg

Now you're ready to do whatever you wanted to with the screenshot!

Back to Linux Tips

Last modified: February 2, 2009, 12:26pm

Valid HTML 4.01!

solvency amendment