In command-line redirection, what does the sequence "command 2>>errorfile.txt" accomplish?

Study for the SANS560 GIAC Penetration Tester (GPEN) Test. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

In command-line redirection, what does the sequence "command 2>>errorfile.txt" accomplish?

Explanation:
Redirection targets the standard error stream and appends it to the specified file. In shells, every command has standard output (1) and standard error (2). Using 2>>errorfile.txt takes whatever error messages the command would print and adds them to the end of errorfile.txt, creating the file if it doesn’t exist. It does not affect standard output, so normal output continues to go to the console unless you redirect it as well. If you used a single > instead of >>, it would overwrite the file instead of appending.

Redirection targets the standard error stream and appends it to the specified file. In shells, every command has standard output (1) and standard error (2). Using 2>>errorfile.txt takes whatever error messages the command would print and adds them to the end of errorfile.txt, creating the file if it doesn’t exist. It does not affect standard output, so normal output continues to go to the console unless you redirect it as well. If you used a single > instead of >>, it would overwrite the file instead of appending.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy