Home » Questions » Computers [ Ask a new question ]

What does "2>&1" do in command line?

What does "2>&1" do in command line?

I know that the > sign is used for output redirection in the command line, but I'm having trouble finding something that explains the use of 2>&1 in the command line. For example:

Asked by: Guest | Views: 496
Total answers/comments: 2
Guest [Entry]

"The 1 denotes standard output (stdout). The 2 denotes standard error (stderr).

So 2>&1 says to send standard error to where ever standard output is being redirected as well. Which since it's being sent to /dev/null is akin to ignoring any output at all."
Guest [Entry]

2 refers to STDERR. 2>&1 will send STDERR to the same location as 1 (STDOUT).