Linux Screen Dump

Using xwd to make screen dumps in Linux

Reviewed by Murray Anderegg 02/27/2013

Making a screen dump of one window

The easiest way to get a screen dump in X windows in Linux is to use the program xwd.  The program displays a a crosshair on the screen.  Move the crosshair to the window you wish to dump and click once.  xwd then dumps the contents of the window as graphic X windows dump data to stdout.  For this command to be useful most people redirect the output of xwd to a file as in the following:

xwd > my-desktop.xwd

To convert the output to a more common format than the XWD format, use a utility such as mogrify from the ImageMagick or graphicsmagick package.  The command:

mogrify -format jpeg my-desktop.xwd

yields a JPEG file named my-desktop.jpeg.

Making a screen dump of the entire screen

Run this to dump the contents of the entire screen:

xwd -root > my-desktop.xwd

If you use multiple workspaces, xwd will only dump the contents of one workspace at a time.

 

Note: The xwd program is a Linux utility only.  Additional information is available on the xwd man page by running.  See ‘man xwd’ for more information.

Another program that is usefull for capturing screen output is script, which is useful for capturing text input and output to a program in a file.  See ‘man script’ for details.