LPIC-1 Exam 101 v5 (Linux Administrator) — Question 66
Which of the following commands redirects the output of ls to standard error?
Answer options
- A. ls >-1
- B. ls <C.ls >&2D.ls >>2E.ls |error
- C. ls >&2
- D. ls >>2
- E. ls |error
Correct answer: C
Explanation
The correct answer is C, as 'ls >&2' properly redirects the output of the ls command to standard error. Option A is incorrect because it attempts to redirect to a non-existent file. Option B is invalid due to its incorrect syntax. Option D redirects output to a file rather than standard error, and option E pipes the output to a command named 'error', which is not a standard error redirection.