mv
Overview
mv renames or moves files and directories — including across filesystems (copy+delete). Atomic rename applies only within the same filesystem.
Syntax
mv [options] source dest
mv [options] source... directoryCommon Options
| Option | Description |
|---|---|
-i |
Interactive |
-n |
No clobber |
-f |
Force |
-u |
Update if newer |
-v |
Verbose |
-b |
Backup dest |
-t dir |
Target directory first |
Examples with Explanations
mv old.txt new.txt
mv file.txt /tmp/
mv -i *.md docs/
mv -n src dest
mv -t /backup/ *.logAtomic replace pattern
mv app.conf app.conf.bak
mv app.conf.new app.confNotes
- Cross-device moves break hard links and may change performance.
- Running processes keep old file content if they hold an open FD after replace.