LPIC-1 Exam 101 (Linux Administrator) — Question 1
Which of the following commands will send output from the program myapp to both standard output (stdout) and the file file1.log?
Answer options
- A. cat < myapp | cat > file1.log
- B. myapp 0>&1 | cat > file1.log
- C. myapp | cat > file1.log
- D. myapp | tee file1.log
- E. tee myapp file1.log
Correct answer: D
Explanation
The correct answer is D because the 'tee' command allows you to send output to both the terminal and a file simultaneously. The other options either do not properly redirect output to both locations or are incorrectly using commands that do not achieve the desired output behavior.