Bird
0
0

You want to append output to log.txt instead of overwriting it. Which command fixes the error in this script?

medium📝 Debug Q14 of 15
Linux CLI - Pipes and Redirection
You want to append output to log.txt instead of overwriting it. Which command fixes the error in this script?
ls -l | tee log.txt
Als -l > tee -a log.txt
Bls -l | tee > log.txt
Ctee -a ls -l log.txt
Dls -l | tee -a log.txt
Step-by-Step Solution
Solution:
  1. Step 1: Identify the need to append output

    The default tee overwrites files. To append, use the -a option.
  2. Step 2: Check correct syntax for appending

    ls -l | tee -a log.txt correctly uses tee -a log.txt with pipe from ls -l. Others misuse redirection or order.
  3. Final Answer:

    ls -l | tee -a log.txt -> Option D
  4. Quick Check:

    Use -a with tee to append = C [OK]
Quick Trick: Add -a option to tee to append instead of overwrite [OK]
Common Mistakes:
  • Using > redirection with tee incorrectly
  • Placing tee before command
  • Forgetting the -a option for append

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes