// denisdefreyne.com / notes
Last revised:
April 2021
Backlinks:

stderr is for all diagnostic output

For command-line program, stdout is used to output the result that the program produces. Anything else, i.e., diagnostic output, needs to be on stderr.

stderr is not for writing errors, confusingly. All log messages (not just errors, but also warnings, and even debug messages) belong on stderr.

If a command-line program takes a -q or --quiet option, then this would silence stderr, but not stdout — the output is the primary product, after all.

If the program doesn’t produce output, then the difference between stdout and stderr is irrelevant.