Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux mv command

Move or rename files and directories.

GNU Coreutils

Syntax

Command form
mv [OPTION]... SOURCE... DESTINATION

Common options

6 options
OptionWhat it does
-i, --interactivePrompt before overwriting a destination.
-n, --no-clobberDo not overwrite an existing destination.
-f, --forceDo not prompt before overwriting.
-u, --updateMove only when the source is newer or destination is missing.
-t, --target-directory=DIRMove all sources into DIR.
-v, --verboseExplain what is being moved.

Usage examples

3 examples

Move or rename files and directories.

mv draft.txt notes.txt

Move a file and prompt if the destination exists.

mv -i draft.txt ./archive/

Rename a file in the same directory.

mv old-name.txt new-name.txt

Notes

A move across filesystems may behave like copy followed by delete; check the destination and backups before replacing files.