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?

link|improve this question

74% accept rate
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
feedback

1 Answer

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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