Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

If I type the following command in Linux:

cat textfile

The contents of textfile is displayed. What is cat actually writing to? Is it writing to stdout or stdin?

share|improve this question
2  
You can't write to stdin. You can only read from it. – Wuffers Apr 30 '11 at 23:59
    
But you can write to another program's stdin. – grawity May 1 '11 at 12:22
up vote 2 down vote accepted

It's writing to stdout.

You can check this by trying the following:

cat textfile > stdout.log 2> stderr.log

You should find that all the output goes to stdout.log, not stderr.log.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .