Operating Systems

A technician must permanently delete the /tmp/old_logs directory, which still contains files. Which command does this?

Show the answer

Correct answerA. rm -r /tmp/old_logs

AWhy this is right: The -r option makes rm recurse, deleting the directory and all files and subdirectories in it.

BWhy not this: rmdir only removes empty directories, so it fails because this one still holds files.

CWhy not this: Without -r, rm refuses to delete a directory and reports an error.

DWhy not this: /dev/null is not a directory to move into; mv does not delete data and the move would fail.

rm -r removes a directory and everything inside it recursively. Plain rm only deletes files and refuses directories, and rmdir only removes empty directories, so neither works here.