Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've overwritten the gnome-screenshot program to suit my needs in getting a screenshot from a secondary home-made graphics card output and now when I press the PrintScreen button it executes it (as desired). However, there are some "printf" statements in the program (written in C) that I would like to be able to see as output. Is there any way to do this? Perhaps by spawning a terminal when the program executes?

Running: Red Hat Enterprise Linux Client release 5.8 (Tikanga)

share|improve this question
You could try using a script to pipe the output to an stdout window. – Breakthrough May 1 '12 at 21:28
Could you elaborate? Example perhaps? – user1028435 May 1 '12 at 22:19
Seth Noble has posted a great answer detailing this. – Breakthrough May 1 '12 at 22:23
I guess I was confused because when I try what he mentioned it creates a "1" file and the log file. I added opening the log in gedit as a second script command after it finishes but didn't know if there was a way for a terminal window instead of a file. – user1028435 May 1 '12 at 22:33
what happens when you pipe the output to echo? (i.e. run myprscr | echo) – Breakthrough May 1 '12 at 22:34
up vote 2 down vote accepted

The simplest way to capture the output would be to wrap your PrintScreen command in a shell and redirect the output to a file. For example, if your program is named myprscr, the shell script might be:

myprscr 2>1 1>>/tmp/myprscr.log

Then have the PrintScreen button run that shell script instead of the your command. You will probably want use the full path for myprscr.

share|improve this answer
Yeah I think this is going to be the winning answer. And to think I went through all that trouble of making a little ASCII progress bar weep. – user1028435 May 1 '12 at 22:15
Just FYI would upvote but I don't have enough karma. – user1028435 May 1 '12 at 22:16
Trying this now, but the output isn't displayed until after the myprscr is completely finished... anyway to do it in "real time?" – user1028435 May 1 '12 at 22:27
You could open another terminal and do tail -f /tmp/myprscr.log – Seth Noble May 2 '12 at 1:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.