Challenge - 5 Problems
Tee Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of tee command?
Consider the command:
What will be the output on the terminal?
echo "Hello World" | tee file.txtWhat will be the output on the terminal?
Linux CLI
echo "Hello World" | tee file.txtAttempts:
2 left
💡 Hint
tee prints the input to both the file and the terminal.
✗ Incorrect
The tee command reads from standard input and writes to standard output and files. So the text is shown on the terminal and saved to file.txt.
💻 Command Output
intermediate2:00remaining
What happens when tee is used with -a option?
Given the command:
What is the effect on file.txt?
echo "New Line" | tee -a file.txtWhat is the effect on file.txt?
Linux CLI
echo "New Line" | tee -a file.txtAttempts:
2 left
💡 Hint
The -a option means append.
✗ Incorrect
The -a option tells tee to append the output to the file instead of overwriting it.
💻 Command Output
advanced2:00remaining
What is the output of tee with multiple files?
What will be the result of:
on the terminal and files?
echo "Data" | tee file1.txt file2.txton the terminal and files?
Linux CLI
echo "Data" | tee file1.txt file2.txtAttempts:
2 left
💡 Hint
tee can write to multiple files at once.
✗ Incorrect
tee writes the input to standard output and all specified files.
💻 Command Output
advanced2:00remaining
What error occurs with invalid tee usage?
What error message appears when running:
echo "Test" | tee -z file.txt?Linux CLI
echo "Test" | tee -z file.txtAttempts:
2 left
💡 Hint
Invalid options cause an error message.
✗ Incorrect
The -z option is not valid for tee, so it prints an invalid option error.
🚀 Application
expert3:00remaining
How to save and display command output simultaneously?
You want to run
ls -l and save its output to listing.txt while also seeing it on the terminal. Which command achieves this?Attempts:
2 left
💡 Hint
tee duplicates output to file and terminal.
✗ Incorrect
Using tee after the pipe sends output to both the file and terminal.