Bird
0
0

You try to rename a file with mv file1.txt file2.txt but accidentally type mv file1.txt /file2.txt and get a permission denied error. Why?

medium📝 Debug Q7 of 15
Linux CLI - File and Directory Operations
You try to rename a file with mv file1.txt file2.txt but accidentally type mv file1.txt /file2.txt and get a permission denied error. Why?
AThe destination file is write-protected.
BThe source file does not exist.
CYou tried to move the file to the root directory without permission.
DThe mv command syntax is invalid.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the difference in destination path

    Using /file2.txt means root directory, which requires special permissions.
  2. Step 2: Reason about permission error

    Permission denied occurs because normal users cannot write to root directory.
  3. Final Answer:

    You tried to move the file to the root directory without permission. -> Option C
  4. Quick Check:

    mv to / needs root permission [OK]
Quick Trick: Leading / means root directory, needs root rights [OK]
Common Mistakes:
MISTAKES
  • Thinking source file missing causes permission error
  • Assuming syntax error instead of permission
  • Ignoring leading slash meaning

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes