Bird
0
0

Which command correctly appends error output to errors.log without erasing existing content?

easy📝 Conceptual Q2 of 15
Linux CLI - Pipes and Redirection
Which command correctly appends error output to errors.log without erasing existing content?
Apython script.py 2> errors.log
Bpython script.py 2>> errors.log
Cpython script.py > errors.log
Dpython script.py >> errors.log
Step-by-Step Solution
Solution:
  1. Step 1: Understand redirection operators

    2>> appends stderr to a file, 2> overwrites it.
  2. Step 2: Analyze options

    python script.py 2>> errors.log uses 2>> to append errors; B overwrites errors; C redirects stdout only; D appends stdout only.
  3. Final Answer:

    python script.py 2>> errors.log -> Option B
  4. Quick Check:

    Use 2>> to append errors, not overwrite. [OK]
Quick Trick: Use 2>> to append errors, not overwrite [OK]
Common Mistakes:
  • Using 2> which overwrites the file
  • Redirecting stdout instead of stderr
  • Confusing > and 2> operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes