XK0-004 · Question #35
Given the output below: Which of the following commands can be used to remove MyPhoto.jpg from the current directory?
The correct answer is E. ln -rm ./Pictures/photo.jpg. This question appears to contain errors - choice label B is absent, and the marked correct answer E uses 'ln -rm' which is not valid Linux syntax. Based solely on the provided correct answer, E is treated as correct here.
Question
Given the output below:
Which of the following commands can be used to remove MyPhoto.jpg from the current directory?
Options
- Aunlink ./MyPhoto.jpg
- Crm -rf ./Pictures
- Drm -f MyPhoto.jpg
- Eln -rm ./Pictures/photo.jpg
How the community answered
(50 responses)- A4% (2)
- C8% (4)
- D14% (7)
- E74% (37)
Why each option
This question appears to contain errors - choice label B is absent, and the marked correct answer E uses 'ln -rm' which is not valid Linux syntax. Based solely on the provided correct answer, E is treated as correct here.
unlink ./MyPhoto.jpg would actually successfully remove the specified file by unlinking it from the directory, making it a technically valid alternative despite not being marked correct.
rm -rf ./Pictures removes the entire Pictures directory and all its contents recursively, not just MyPhoto.jpg from the current working directory.
rm -f MyPhoto.jpg forcibly removes MyPhoto.jpg from the current directory without prompting, which is also a technically correct operation despite not being marked as the answer.
Note: ln -rm ./Pictures/photo.jpg is not a valid Linux command because ln creates hard or symbolic links and does not accept an -rm flag for removal. This answer appears to be an error in the question; the technically valid commands for removing MyPhoto.jpg from the current directory would be rm -f MyPhoto.jpg (D) or unlink ./MyPhoto.jpg (A).
Concept tested: Linux file removal and link management commands
Source: https://man7.org/linux/man-pages/man1/rm.1.html
Topics
Community Discussion
No community discussion yet for this question.