Lpic 1 Linux Administrator · Free Practice Question Medium
Question 23
- A Standard output (stdout) is redirected to file1, and standard error (stderr) is redirected to file2.
- B A new file descriptor file1 is created and its output is redirected to file2.
- C Standard error (stderr) is redirected to file1, and standard output (stdout) is redirected to file2.
- D The wc command reads its input from standard input (stdin), typically the keyboard.
Reveal correct answer
Correct answer: A
A. This choice is correct because the command wc -c 1> file1 2> file2 redirects standard output (stdout) to file1 and standard error (stderr) to file2. This means that the character count output of the wc command will be stored in file1, and any error messages or warnings will be stored in file2.
B. This choice is incorrect because the command does not create a new file descriptor. It simply redirects the standard output and standard error to the specified files file1 and file2.
C. This choice is incorrect because it states that standard error (stderr) is redirected to file1 and standard output (stdout) is redirected to file2, which is the opposite of what actually happens in the given command.
D. This choice is incorrect because it does not accurately describe the behavior of the command wc -c 1> file1 2> file2. The command redirects the output and error streams to files, it does not read input from standard input (stdin).
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
