Bird
0
0

You try to delete a directory reports using rm -r reports but receive the error: rm: cannot remove 'reports/file.txt': Permission denied. What is the most probable cause?

medium📝 Debug Q6 of 15
Linux CLI - File and Directory Operations
You try to delete a directory reports using rm -r reports but receive the error: rm: cannot remove 'reports/file.txt': Permission denied. What is the most probable cause?
AYou used the wrong command; <code>rmdir</code> should be used instead.
BThe directory <code>reports</code> does not exist.
CThe directory is empty, so rm -r cannot remove it.
DYou lack write permission on one or more files inside the directory.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error message

    The error indicates permission denied on a file inside the directory.
  2. Step 2: Analyze permissions

    Even with rm -r, if you lack write permission on files or directories, removal will fail.
  3. Step 3: Other options invalid

    The directory exists (otherwise error would be different), rm -r works on empty directories, and rmdir is not required here.
  4. Final Answer:

    Lack of write permission on files inside the directory. -> Option D
  5. Quick Check:

    Permission denied means insufficient rights [OK]
Quick Trick: Permission denied means missing write rights on files [OK]
Common Mistakes:
  • Assuming directory does not exist
  • Confusing empty directory errors
  • Thinking rmdir is needed for non-empty directories

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes