Bird
0
0

Which of the following is the correct syntax to rename a file old.txt to new.txt using mv?

easy📝 Syntax Q12 of 15
Linux CLI - File and Directory Operations
Which of the following is the correct syntax to rename a file old.txt to new.txt using mv?
Amv old.txt new.txt
Bmv new.txt old.txt
Cmv -r old.txt new.txt
Dmv old.txt -n new.txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand basic mv syntax

    The syntax is mv source destination. To rename, source is old name, destination is new name.
  2. Step 2: Check each option

    mv old.txt new.txt correctly uses mv old.txt new.txt. mv new.txt old.txt reverses source and destination. Options A and D use invalid options.
  3. Final Answer:

    mv old.txt new.txt -> Option A
  4. Quick Check:

    mv source destination = rename [OK]
Quick Trick: Syntax: mv oldname newname to rename [OK]
Common Mistakes:
MISTAKES
  • Swapping source and destination
  • Using invalid options like -r or -n
  • Confusing mv with cp syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes