Bird
0
0

Which command appends the output of date to a file named log.txt without deleting existing content?

easy📝 Conceptual Q2 of 15
Linux CLI - Pipes and Redirection
Which command appends the output of date to a file named log.txt without deleting existing content?
Adate < log.txt
Bdate > log.txt
Cdate | log.txt
Ddate >> log.txt
Step-by-Step Solution
Solution:
  1. Step 1: Identify the append operator

    The '>>' operator appends output to a file without deleting existing content.
  2. Step 2: Match command with append operator

    'date >> log.txt' appends the current date and time to log.txt.
  3. Final Answer:

    date >> log.txt -> Option D
  4. Quick Check:

    Append redirection = A [OK]
Quick Trick: Use '>>' to add output to file without erasing [OK]
Common Mistakes:
  • Using '>' which overwrites file
  • Using pipe '|' incorrectly with file
  • Using '<' which is input redirection

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes