XK0-005 · Question #526
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?
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…
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
How the community answered
(34 responses)- A3% (1)
- B6% (2)
- D91% (31)
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.