stdout vs stderr

Debate on proper use of stdout for data output versus stderr for errors, logs, and info in Unix CLI tools, covering piping, buffering, TTY detection, and best practices.

📉 Falling 0.3x DevOps & Infrastructure
2,511
Comments
19
Years Active
5
Top Authors
#1359
Topic ID

Activity Over Time

2008
9
2009
21
2010
38
2011
83
2012
72
2013
96
2014
134
2015
94
2016
146
2017
164
2018
178
2019
149
2020
178
2021
177
2022
293
2023
263
2024
251
2025
146
2026
19

Keywords

e.g STDIN stackexchange.com tens.sh make.ht TTY i.e OS README.md github.com output cat file console terminal error debugging results redirecting dev

Sample Comments

tyingq Sep 23, 2019 View on HN

Any screenshots of what it does with stderr?

coldtea Jun 25, 2023 View on HN

That would be stderr but hell yes

BillinghamJ Oct 24, 2019 View on HN

That's true of stderr output. You should be able to parse stdout though - otherwise how are you meant to use piping etc

pepve Dec 3, 2012 View on HN

Some tools adjust their output based on it going to a terminal or not. Try 'ls' versus 'ls | cat'.

wtetzner Sep 25, 2012 View on HN

Maybe there should be a stdad so it won't be mixed in with the data going to stdout.

chrism238 Jan 22, 2023 View on HN

Surely the title of the post and article should say “… redirect stdout …” ?

thrwyoilarticle Jul 29, 2021 View on HN

stderr instead of stdout is silly.

jlgreco Sep 25, 2012 View on HN

Why should polluting stderr be seen as any better than polluting stdout?

the8472 Nov 30, 2019 View on HN

it also makes sense for stdout, e.g. when you're spewing binary data that might corrupt a terminal.

Athas Oct 11, 2016 View on HN

Is that not why you have stderr?