Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.