Difficulty: Easy
Correct Answer: -i
Explanation:
Introduction / Context:
File deletion on Unix/Linux is immediate and typically irreversible without backups. To reduce risk, the rm command provides an interactive mode that asks for confirmation for each item, making accidental mass deletions less likely—especially helpful when using wildcards.
Given Data / Assumptions:
Concept / Approach:
The -i option activates interactive prompts in rm, asking 'remove regular file 'name'?'. Some distributions also offer the more aggressive -I (capital i) to prompt once if the operation is large. The -r (or -R) option is recursive deletion for directories; it does not prompt by itself. Other flags shown (-x, -1) are not standard rm options for interactivity.
Step-by-Step Solution:
Verification / Alternative check:
Run a dry run using echo: echo rm -i *.log to verify expansion. Then perform rm -i and confirm that prompts appear. Use aliases (for example, alias rm='rm -i') as a safety net if desired.
Why Other Options Are Wrong:
Common Pitfalls:
Relying solely on -i but using sudo in scripts (aliases may be bypassed), or forgetting that rm -rf will remove without prompting—use with extreme caution.
Final Answer:
-i
Discussion & Comments