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

Some programs print their binary output directly on stdout. Here are some examples:

tar -c file.png
dd  if=file.png

Well, I see that the output can be redirected to a file. But these programs already accept output filenames as arguments. So, following commands will give the same results:

tar -c file.png  > file.tar
tar -c file.png -f file.tar

dd if=file.png  > copy.png
dd if=file.png of=copy.png

For what other purpose can binary output from stdout be used?

share|improve this question
From a program's point of view, stdout is just a file descriptor which you can write() to. What is the use of not allowing binary output to it? – grawity Sep 13 '11 at 11:07
up vote 7 down vote accepted

For building pipelines, obviously. The biggest advantage is that you can avoid having to create temporary files:

(For this example, assume an old version of tar which does not have -J or -I compression options.)

tar -c foo/*.png | xz -9 | uuencode "foo.tar.xz" | mail -s "Sending foo" musa
  • Now imagine if you had to use -f and stuff... you'd have VMS.

    tar -cf foo.tar foo/*.png
    xz -9 -o foo.tar.xz foo.tar
    uuencode -o foo.uue foo.tar.xz 
    mail -a foo.uue -s "Sending foo" musa
    rm foo.tar foo.tar.xz foo.uue

You can do pipelines over the network:

ssh storageserver "cd ~/foo && tar -c bar" | pv | tar -x

curl | ssh mylaptop "gpg --decrypt" >

More examples:

curl | display

And sometimes you don't even need to pipe it anywhere, even if the output is "binary". Try this on a Xterm:

curl         # Utah teapot
share|improve this answer

Purposes may vary as per user. A developer can use that info for logging, or progress track or even error handling.

share|improve this answer
How do you log binary data, track progress or handle errors? Can you explain a bit? – slhck Sep 13 '11 at 8:41
@slhck: pv – grawity Sep 13 '11 at 9:07
@grawity I know pv, but it would be nice for Mr. K to add a little more info. – slhck Sep 13 '11 at 9:19

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.