Which of the following commands pipes stdout and stderr from cmd1 to cmd2?
A.
cmd2 | cmd1
B.
cmd2 2>&1 | cmd1
C.
cmd1 | cmd2
D.
cmd1 2>&1 | cmd2
Explanation:
The cmd1 2>&1 | cmd2 command pipes stdout and stderr from cmd1 to cmd2.
Answer option C is incorrect. The cmd1 | cmd2 command pipes stdout from cmd1 to cmd2.
Answer option B is incorrect. The cmd2 2>&1 | cmd1 command pipes the stdout and stderr from
cmd2 to cmd1.
Answer option A is incorrect. The cmd2 | cmd1 command pipes stdout from cmd2 to cmd1.