CompTIA Linux+ (XK0-005) — Question 2

A Linux administrator was tasked with deleting all files and directories with names that are contained in the sobelete.txt file. Which of the following commands will accomplish this task?

Answer options

Correct answer: D

Explanation

The correct answer is D because it uses 'xargs' to read filenames from 'toDelete.txt' and passes them to 'rm -rf' for deletion. Option A has an incorrect command structure, option B attempts to remove 'toDelete.txt' itself instead of its contents, and option C is syntactically incorrect as 'rm' does not accept input directly from a pipe in this manner.