Bird
0
0

Why does mv file1.txt file2.txt overwrite file2.txt without warning by default, and how can you prevent it?

hard📝 Conceptual Q10 of 15
Linux CLI - File and Directory Operations
Why does mv file1.txt file2.txt overwrite file2.txt without warning by default, and how can you prevent it?
Amv never overwrites files; it always creates a backup.
Bmv overwrites silently; use <code>mv -i</code> to prompt before overwrite.
Cmv overwrites only if files are identical; otherwise, it errors.
Dmv requires special permission to overwrite files.
Step-by-Step Solution
Solution:
  1. Step 1: Understand mv overwrite behavior

    By default, mv replaces destination files without asking.
  2. Step 2: Learn how to prevent silent overwrite

    Using mv -i makes mv ask for confirmation before overwriting.
  3. Final Answer:

    mv overwrites silently; use mv -i to prompt before overwrite. -> Option B
  4. Quick Check:

    mv -i prompts before overwrite [OK]
Quick Trick: Use mv -i to confirm before overwriting files [OK]
Common Mistakes:
  • Thinking mv never overwrites
  • Assuming automatic backups happen
  • Believing permissions control overwrite prompts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes