GnoseedGnoseed
DevOps · Flashcard

Why does command 2>&1 >file still leave error output on the terminal?

Why this is the answer

Redirections apply left to right: 2>&1 first aims stderr at stdout's CURRENT target (the terminal), then >file moves stdout to the file — stderr still points at the terminal. Use >file 2>&1 to send both to the file. Option two is a myth — stderr redirects fine with 2>. Option three invents a one-stream limit. Option four has the order backwards.

Read more in the docs
Study in Gnoseed →