Unix provides standard output and standard error, which can be redirected independently.

$ ls /not-exist
ls: cannot access '/not-exist': No such file or directory

$ ls /not-exist > redirect.out
ls: cannot access '/not-exist': No such file or directory

$ ls /not-exist 2> redirect.err

I heard there's a story somewhere on the Web, which gives a fun reason why this separation was implemented. It involves the computerized typesetting that early Unix was used for (and Unix pipelines, I think). I failed to find it right now.

Would anyone like to link that story here, to associate it with the relevant tags and make it easier to find?

  • 2
    "Somewhere on the Web" means "in the Wikipedia article on this subject" in this case. – JdeBP Aug 8 '18 at 12:06

There's Steve C. Johnson's 2013 account of this, as a user, where users complain about phototypesetting and — lo! — the problem is fixed two days later. But Douglas McIlroy told the tale slightly differently a quarter of a century earlier.

In McIlroy's version, standard error was a natural consequence of Ken Thompson's famous all-nighter introduction of the Unix command pipeline. In the world of Unix prior to the pipeline, the fact that errors would be sent to the file where standard output had been redirected to was "trouble". But after the introduction of the pipeline, this behaviour "became intolerable when the output was sent to an unsuspecting process". McIlroy recounts that Dennis Ritchie introduced the standard error mechanism to finally rectify this "shortly" after Sixth Edition.

Also, McIlroy had of course been working on the idea of pipelines in Unix for a fair while, by this point, including a number of proposals over the period of at least 2 years; having invented the garden hosepipe metaphor half a decade earlier than that. The concept of a separate stream distinct from the pipeline streams did not magically appear from nothing in just a couple of days.

Further reading


"Somewhere on the Web" means "in the Wikipedia article on this subject" in this case. – JdeBP

Standard error was added to Unix after several wasted phototypesetting runs ended with error messages being typeset instead of displayed on the user's terminal. – Wikipedia


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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