LPIC-1 Exam 101 (Linux Administrator) — Question 38
Which of the following shell redirections will write standard output and standard error output to a file named filename?
Answer options
- A. 2>&1 >filename
- B. >filename 2>&1
- C. 1>&2>filename
- D. >>filename
- E. 1&2>filename
Correct answer: B
Explanation
Option B is correct because it first redirects standard output to 'filename' and then redirects standard error to the same destination as standard output. The other options either redirect output incorrectly or do not achieve the desired effect of combining both outputs into the same file.