ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 53 - XK0-005 discussion

Report
Export

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?

A.
xargs -f cat toDelete.txt -rm
Answers
A.
xargs -f cat toDelete.txt -rm
B.
rm -d -r -f toDelete.txt
Answers
B.
rm -d -r -f toDelete.txt
C.
cat toDelete.txt | rm -frd
Answers
C.
cat toDelete.txt | rm -frd
D.
cat toDelete.txt | xargs rm -rf
Answers
D.
cat toDelete.txt | xargs rm -rf
Suggested answer: D

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. This is the correct way to accomplish the task. The other options are incorrect because they either use the wrong options (-f instead of -a for xargs), the wrong arguments (toDelete.txt instead of toDelete.txt filename for rm), or the wrong commands (rm instead of xargs). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11:

Managing Files and Directories, pages 349-350.

asked 02/10/2024
JORGE ROCHA
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first