Move and rename
Move or rename with mv
⏱ Est. ~5 min
01 · Read
The mv command does two jobs at once: it can move a file to a new location, and it can rename a file. Same command, two uses.
💡 Picture thisThink of mv as picking something up and putting it somewhere else. If you put it back in the same spot with a different name — that's a rename.
Key points
- mv is short for move
- mv file newname renames it in place
- mv file folder/ moves it into that folder
02 · Terminal exercise
mv does two jobs: move a file to a new location, or rename it. Same command, different uses.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
style.css should live inside the css folder. Let's make that folder first.
(This section is interactive — please enable JavaScript.)
04 · Fill in the blank
To rename old.txt to new.txt, you'd type: ___ old.txt new.txt
05 · Terminal exercise
Now move the CSS file into the new folder.
(This section is interactive — please enable JavaScript.)
06 · Terminal exercise
Confirm the move worked.
(This section is interactive — please enable JavaScript.)
07 · Quiz
What makes mv special compared to cp?
- It only works on folders
- It automatically makes a backup
- It does double duty: moving a file and renaming a file (same command)
- It's faster than cp
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.