Bird
0
0

You have a script that runs multiple commands and you want to save all their outputs to a single file without losing previous data. Which approach is correct?

hard📝 Application Q9 of 15
Linux CLI - Pipes and Redirection
You have a script that runs multiple commands and you want to save all their outputs to a single file without losing previous data. Which approach is correct?
AUse '>>' for each command to append output to the file.
BUse '>' for each command to overwrite the file.
CUse '|' to redirect output to the file.
DUse '<' to redirect output to the file.
Step-by-Step Solution
Solution:
  1. Step 1: Understand multiple command outputs

    To keep all outputs, file content must not be overwritten after each command.
  2. Step 2: Use append operator for each command

    '>>' appends output, preserving previous data.
  3. Final Answer:

    Use '>>' for each command to append output to the file. -> Option A
  4. Quick Check:

    Append for multiple outputs = A [OK]
Quick Trick: Append each output with '>>' to keep all data [OK]
Common Mistakes:
  • Using '>' overwrites previous outputs
  • Confusing pipe '|' with file redirection
  • Using input redirection '<' incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes