Difficulty: Easy
Correct Answer: rm
Explanation:
Introduction / Context:
Deleting files is a frequent operation in UNIX/Linux. The shell provides a well-known command that removes files and, with appropriate flags, directories. Proper usage prevents accidental data loss and supports scripted cleanups in build systems and cron jobs.
Given Data / Assumptions:
Concept / Approach:
The rm command removes directory entries, effectively deleting files. Common flags: -i (interactive prompt), -f (force), -r or -R (recursive for directories), and -v (verbose). Always double-check patterns to avoid unintended deletions.
Step-by-Step Solution:
Remove a file: rm file.txtPrompt before each removal: rm -i *.logRemove a directory tree carefully: rm -r old_projectCombine force and recursive (use cautiously): rm -rf tmpdir
Verification / Alternative check:
List directory contents with ls before and after. Use trash utilities on desktop environments if you prefer recoverable deletions; rm bypasses a “trash can.”
Why Other Options Are Wrong:
erase (Option A) and delete (Option B) are DOS/Windows commands, not standard UNIX.dm (Option D) is not a removal command.None of the above (Option E) is incorrect because rm is correct.
Common Pitfalls:
Final Answer:
rm
Discussion & Comments