Bird
0
0

What will be the content of errors.log after running this command twice?

medium📝 Command Output Q4 of 15
Linux CLI - Pipes and Redirection
What will be the content of errors.log after running this command twice?
ls nonexistfile 2>> errors.log
AThe command will cause a syntax error
BThe file contains only one error message from the last run
CThe file contains two error messages, one from each run
DThe file is empty because errors are not redirected
Step-by-Step Solution
Solution:
  1. Step 1: Understand 2>> operator effect

    2>> appends error messages to the file without deleting previous content.
  2. Step 2: Analyze repeated command runs

    Running twice appends two separate error messages to errors.log.
  3. Final Answer:

    The file contains two error messages, one from each run -> Option C
  4. Quick Check:

    Appending errors twice = D [OK]
Quick Trick: 2>> appends errors, so multiple runs add messages [OK]
Common Mistakes:
  • Thinking 2>> overwrites the file
  • Assuming only last error is saved
  • Confusing 2>> with 2> which overwrites

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes