Difficulty: Easy
Correct Answer: >> symbols
Explanation:
Introduction / Context:
Command-line redirection is fundamental in Unix and Linux. You frequently need to add new output to the end of a log or report without destroying what is already there. Distinguishing between overwrite and append operators prevents data loss and supports safe scripting.
Given Data / Assumptions:
Concept / Approach:
The operator > sends standard output to a file and truncates it first. The operator >> appends standard output to the file, creating it if it does not exist. Operators like < and << read from files or here-documents and do not write to files.
Step-by-Step Solution:
Verification / Alternative check:
Create a test file: echo "first" > demo.txt. Then append: echo "second" >> demo.txt. Display with cat demo.txt and confirm both lines appear, proving that >> appended rather than overwrote.
Why Other Options Are Wrong:
Common Pitfalls:
Accidentally using > when you intended to append can destroy logs. For safety, some shells support noclobber to prevent overwrites, or you can use >> consistently for logs. Always test redirections on scratch files first.
Final Answer:
>> symbols
Discussion & Comments