top | item 47180612

(no title)

james_marks | 2 days ago

Claude’s answer, which is the only one that clicked for me:

Normally when you do something like command > file.txt, you’re only capturing the normal output — errors still go to your screen.

2>&1 is how you say: “send the error pipe into the same place as the normal output pipe.” Breaking it down without jargon: • 2 means “the error output” • > means “send it to” • &1 means “wherever the normal output is currently going” (the & just means “I’m referring to a pipe, not a file named 1”)

discuss

order

DonaldPShimoda|2 days ago

> Claude’s answer

This response is essentially just the second answer to the linked question (the response by dbr) with a bunch of the important words taken out.

And all it cost you to get it was more water and electricity than simply clicking the link and scrolling down — to say nothing of the other costs.

james_marks|2 days ago

FWIW, I clicked the link, scanned the SO thread, then scanned the HN thread. The "bunch of important words taken out" is exactly the service I paid AI for.

"I didn't have time to write you a short letter, so I wrote you a long one." is real.

NekkoDroid|2 days ago

> • 2 means “the error output” • > means “send it to” • &1 means “wherever the normal output is currently going” (the & just means “I’m referring to a pipe, not a file named 1”)

If you want it with the correct terminology:

2 means "file descriptor 2", > means "assign the previous mentioned to the following", &2 means "file descriptor 1" (and not file named "1")