XK0-005 · Question #1521
XK0-005 Question #1521: Real Exam Question with Answer & Explanation
The correct answer is D: cat toDelete.txt | xargs rm -rf. The command cat toDelete.txt | xargs rm -rf will delete all files and directories with names that are contained in the toDelete.txt file. The cat command reads the file and outputs its contents to the standard output. The | operator pipes the output to the next command. The xargs
Question
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?
Options
- Axargs -f cat toDelete.txt -rm
- Brm -d -r -f toDelete.txt
- Ccat toDelete.txt | rm -frd
- Dcat toDelete.txt | xargs rm -rf
Explanation
The command cat toDelete.txt | xargs rm -rf will delete all files and directories with names that are contained in the toDelete.txt file. The cat command reads the file and outputs its contents to the standard output. The | operator pipes the output to the next command. The xargs command converts the output into arguments for the next command. The rm -rf command removes the files and directories recursively and forcefully.
Topics
Community Discussion
No community discussion yet for this question.