APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Unix, Xenix and ODT General FAQ

© September 2009 Anthony Lawrence

How do I capture program screens to a file or print them?

Updated September 2009

Unix/Linux text screens

To capture text output, use "script". By default, the file will be called "typescript", but "script myfile" will use that name instead. Press CTRL-D when you are finished recording.

You can play back keystokes with "xmacro". See Replace Your Show Desktop Button, which notes that capturing CTRL-ALT-d was the major problem solved by xmacro.


("script" applies to Terminal sessions)

Command-Shift-3 (whole screen) and Command-Shift-4 (portion of screen) will create "Picture x" (x is 1 to whatever). Because of better features and control, I prefer Skitch, though Voila has even more features.

Preview also offers screen capture - it's down at the bottom of the File menu.

For a movie of your screen actions, try Jing (also available for Windows).


To capture X screens, the "xwd" program is simple to use. Open an xterm, type "xwd > file" and (after pressing ENTER), just click on the window you want to capture. You can also specify a windo with "xwd -id wid", where "wid" is the resource id to be selected. The resulting file can be printed using "xpr" or manipulated by graphic programs like "Gimp" and others if you need to save it as .gif or some other format.

For KDE, there is KSnapshot and gnome-screenshot for Gnome. Both also recognize the PRT-SCRN key

To record screen actions on Linux, try RecordMyDesktop, a "desktop session recorder".


For a "user friendly" OS, Windows has had really awful screen capture in the past. You press PRT-SCRN, which appears to do nothing. You then have to open a program like Microsoft Paint, hit CTRL-V to paste in the shot, and then you can do whatever you want with it.

Vista and Win 7 have "Snipping Tool", which is supposedly much better (but I've never used it).

This Screenpresso looks good.


Tom Melvin contributed this:

No idea where I got this from, it's pretty old (Xenix days). Works only on the console.

# Shell script to screen dump
# This will only work at present on the  main console

oldstty=`stty -g`
stty -echo ixon ixoff -ixany
/bin/echo '\033[2i\c'
head -25 > /tmp/screen.$$
stty $oldstty

# Ok now output the file to the printer
echo "\f" >>/tmp/screen.$$
lp /tmp/screen.$$
rm /tmp/screen.$$

Or get Chip Rosenthal's prtscrn from ftp.jpr.com

Jean Pierre Radley points out:

W/r to Melvin's comment about the escape sequence, man screen and see:

   MC (Media Copy)                         CSI p1 i   ps        mc0
   Causes all or part of the screen to
   be sent to the pass-through printer.
   Parameter p1 indicates how much of
   the screen to send to the printer.
   Currently, only p1=2 is supported,
   which sends the entire screen
   contents. Future versions of scoansi
   may support other values.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> How do I capture program screens to a file or print them?

1 comment

Inexpensive and informative Apple related e-books:

Digital Sharing Crash Course

iOS 8: A Take Control Crash Course

Take Control of High Sierra

Photos: A Take Control Crash Course

Take Control of the Mac Command Line with Terminal, Second Edition

More Articles by © Anthony Lawrence

Mon Sep 17 09:38:25 2012: 11326   TonyLawrence


Something new for Windows and Mac:


Web based - no download, but they store the video.


Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Computers are useless. They can only give you answers. (Pablo Picasso)

Linux posts

Troubleshooting posts

This post tagged:







Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode