I noticed that we have mainly 3 file streams. They are STDIN, STDOUT and STDERR.. My question is why is STDERR redirected to STDOUT?
stderr
is not redirected to stdout
. Both streams are only connected to the same device (the current screen or terminal) by default.
You can redirect them to different files:
$ command > stdout.log 2> stderr.log
In order to actually redirect stderr
to stdout
, you have to issue:
$ command 2>&1
It is not; it just happens that both stdout and stderr are typically mapped to the same output stream (usually the console). If you redirect stdout to a file for example you will find that stderr remains directed to the console.
The important point is that they are independently redirectable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With