Bird
0
0

Which command correctly appends sensor data to a log file on Raspberry Pi?

easy📝 Syntax Q12 of 15
Raspberry Pi - Data Logging and Databases
Which command correctly appends sensor data to a log file on Raspberry Pi?
Aecho "temp=25" >> sensor.log
Becho "temp=25" > sensor.log
Ccat sensor.log >> echo "temp=25"
Decho "temp=25" | sensor.log
Step-by-Step Solution
Solution:
  1. Step 1: Understand shell redirection operators

    '>>' appends text to a file, '>' overwrites the file.
  2. Step 2: Choose the command that appends data

    Only 'echo "temp=25" >> sensor.log' appends without erasing existing data.
  3. Final Answer:

    echo "temp=25" >> sensor.log -> Option A
  4. Quick Check:

    Append with >> operator [OK]
Quick Trick: Use >> to add data without erasing file [OK]
Common Mistakes:
MISTAKES
  • Using > which overwrites the file
  • Misusing cat or pipe commands incorrectly
  • Confusing append and overwrite operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes