Skip to main content
Kill -9 Club
Sign in

standard error (stderr)

Processes

Stream 2, the channel a process writes its diagnostics and failures to, separate from stream 1, standard output, which carries the result you asked for. Both land on your terminal by default, which is what makes them look like one stream — and what makes two habits fail silently. command > file redirects stream 1 only: the errors stay on screen and never reach the file. command | grep pattern pipes stream 1 only, so ls /etc/hostname /etc/missing | grep missing prints nothing although the word is plainly on your screen. In both cases 2>&1 goes before the |, and after the file in > file 2>&1, because the shell applies redirections left to right. And 2> /dev/null removes the message, not the failure — $? is still 1.

Also written: stderr, stream 2, file descriptor 2