$ tty
/dev/tty0
On
$cat
in user-space, cat process waits on it's stdin to receive input from /dev/tty0 file.
On listing non-existent file fff,
ls /fff > file1
ls cannot find file :file1 Access denied
Despite redirection of stdout to file1 instead of /dev/tty0, the error about, file does not exist, will display on /dev/tty0 through stderr file descriptor.
Question:
If stderr writes to /dev/tty0 similar to stdout, what is the purpose of stderr?
What was the idea behind, UNIX/Linux maintaining one more file descriptor stderr for writing error to /dev/tty0 ?
stdout
to be redirected to a file AND not thestderr
. Meaning,stderr
is still going to the terminal, /dev/tty0. So what's the issue here? – May 07 '17 at 04:38