mv

Move or rename a file

What it does

mv moves a file or folder somewhere else. Renaming is the same move: mv old.txt new.txt keeps the file in the same folder under a new name.

Unlike cp, it moves folders without extra flags. You can pass several files if the last argument is a folder: mv a.txt b.txt archive/.

Careful. If a file with the new name exists, mv silently replaces it. mv -i asks before overwriting.

Syntax

mv <source> <destination>
mv <file>… <folder>

Examples

Related commands

Practise · All commands