Bird
0
0

What is wrong with this command if you want to rename file.txt to document.txt but get an error?

medium📝 Debug Q14 of 15
Linux CLI - File and Directory Operations
What is wrong with this command if you want to rename file.txt to document.txt but get an error?
mv file.txt document.txt/
ATrailing slash after document.txt treats it as a directory
BMissing -r option to rename files
CSource file does not exist
Dmv cannot rename files
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the command

    The command has document.txt/ with a trailing slash, which means it expects a directory named document.txt.
  2. Step 2: Understand error cause

    If document.txt is not a directory, mv will error because it cannot move file.txt into a non-existent directory.
  3. Final Answer:

    Trailing slash after document.txt treats it as a directory -> Option A
  4. Quick Check:

    Trailing slash means directory, causes error if not directory [OK]
Quick Trick: No slash after filename when renaming [OK]
Common Mistakes:
  • Adding slash after new filename
  • Thinking -r is needed to rename
  • Assuming mv cannot rename files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes