Rename a file with mv

Give a file or folder a new name without copying it.

LinuxrenamemoveLow risk
Run mv old-name.txt new-name.txt — the file is renamed in place, nothing is copied.

01Command

Command
$ mv draft-v1.txt draft-v2-final.txt && mv configs configs-backup

02What it does

mv doesn't have a rename mode: renaming is just moving within the same directory. It also works on folders, and mv ../report.txt . pulls a file into the current directory while you're at it. Use mv -i to get a confirmation prompt if the target name already exists.

03Risk

RiskLow risk
!Warning: mv silently overwrites the destination if it exists — mv a.txt b.txt when b.txt is your only copy of something destroys it without a word. Use mv -i (or set alias mv='mv -i') to make collisions ask first.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • mv(1) — Linux manual page
    man7.org · community · 2026-09-17
    Evidence: mv renames a file or moves it to a different directory; renaming is mv oldname newname in the same directory.

Last verified: 2026-09-18 · Category: Files & Folders