Difficulty: Easy
Correct Answer: rm
Explanation:
Introduction / Context:
Every Unix/Linux user needs to manage files from the shell. Deleting files is a routine operation and is performed with a specific utility that removes directory entries. Knowing the correct command prevents confusion with copy, move, or rename operations.
Given Data / Assumptions:
Concept / Approach:
On Unix-like systems, rm removes directory entries for files. If the last link to a file is removed and no process holds it open, the storage is reclaimed by the filesystem. For directories, rmdir or rm -r is used. Options such as -i prompt for confirmation, -f forces removal, and -r recursively removes directories and their contents.
Step-by-Step Solution:
Verification / Alternative check:
If the file persists, check permissions on the parent directory and confirm no alias or function overrides rm. Also verify that the filename is correct (quote paths with spaces).
Why Other Options Are Wrong:
Common Pitfalls:
Using rm -r carelessly, globbing patterns that match more files than intended, or lacking proper backups. Consider rm -i or trash utilities for safety.
Final Answer:
rm
Discussion & Comments