CompTIA Linux+ Powered by LPI (LX0-103) — Question 9

Which of the following shell redirections will write standard output and standard error output to a file named filename?

Answer options

Correct answer: B

Explanation

The correct answer, B, uses '>filename' to redirect standard output to the file first and then '2>&1' to redirect standard error to the same destination. Option A redirects standard error to standard output first but does not redirect standard output to the file correctly. Option C is incorrectly formatted and does not achieve the desired output redirection. Option D only appends standard output to the file, and option E is a syntax error.