Take the 2-minute tour ×

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


