Bird
0
0

Which command correctly uses tee to append output to a file named log.txt?

easy📝 Conceptual Q2 of 15
Linux CLI - Pipes and Redirection
Which command correctly uses tee to append output to a file named log.txt?
Aecho "Hello" | tee -a log.txt
Becho "Hello" | tee log.txt
Cecho "Hello" > tee -a log.txt
Decho "Hello" | tee --overwrite log.txt
Step-by-Step Solution
Solution:
  1. Step 1: Identify append option for tee

    The -a flag tells tee to append to the file instead of overwriting.
  2. Step 2: Check command syntax

    echo "Hello" | tee -a log.txt uses tee -a log.txt, which appends output correctly.
  3. Final Answer:

    echo "Hello" | tee -a log.txt -> Option A
  4. Quick Check:

    Append flag for tee = -a [OK]
Quick Trick: Use -a with tee to append instead of overwrite [OK]
Common Mistakes:
  • Using > instead of tee for appending
  • Forgetting the -a flag causes overwrite
  • Using invalid options like --overwrite

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes