Bird
0
0

What will be the result of running mv file.txt file.txt in a Linux terminal?

medium📝 Command Output Q5 of 15
Linux CLI - File and Directory Operations
What will be the result of running mv file.txt file.txt in a Linux terminal?
AThe file is deleted.
BThe file is moved to the current directory.
CAn error message is shown.
DThe file is renamed to itself with no change.
Step-by-Step Solution
Solution:
  1. Step 1: Understand mv behavior when source and destination are same

    If source and destination names are identical, mv does nothing but succeeds silently.
  2. Step 2: Apply to given command

    Running mv file.txt file.txt leaves the file unchanged.
  3. Final Answer:

    The file is renamed to itself with no change. -> Option D
  4. Quick Check:

    mv same source and dest = no change [OK]
Quick Trick: mv same source and destination does nothing [OK]
Common Mistakes:
  • Expecting error on same name
  • Thinking file is deleted
  • Confusing move with copy

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes