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'm using an application (the dot program of the graphviz library) that generates a wide variety of file formats including PostScript and PDF. It can send the result to stdout or to a file. I'm currently sending it to a file and opening it with Preview.

Is there any way to pipe the output and have it be read by Preview, so that I'd don't have to generate a file and have it lying around? This is going to be used by a number of people who won't know the internal structure of the generating script and I don't want to clutter their folders or complicate their lives.

More generally, is there any way to take a program that sends its output to stdout and pass that output to an program that usually takes it's input from a file, without actually creating a file?

share|improve this question

migrated from Jul 1 '11 at 22:05

This question came from our site for professional and enthusiast programmers.

Save your document in $TEMP and then launch Preview using open - that way it will appear pretty seamless and the saved documents under /tmp will get cleaned up eventually. – Paul R Jul 1 '11 at 18:59
up vote 12 down vote accepted
$ your_program | open -f -a /Applications/

Source: View Terminal ‘man’ Pages In Preview / PDF

share|improve this answer

f=$(mktemp -t test).txt; echo test > $f; open $f -a TextEdit # f=$TMPDIR/test.txt

share|improve this answer

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.