Skip to content

mv command

Move or rename files and directories.

On this page

Syntax

mv [options] source… destination

Provided by the coreutils package. Run man mv for the full manual.

Common options

OptionWhat it does
-iAsk before overwriting
-nNever overwrite existing files
-fOverwrite without asking
-uMove only when the source is newer
-vPrint each file moved
-t DIRMove all sources into DIR

Examples

  1. Rename a file

    mv old.txt new.txt
  2. Move a file into a directory

    mv report.pdf ~/Documents/
  3. Move several files

    mv *.log /var/log/archive/
  4. Ask before overwriting

    mv -i file.txt /backup/
  5. Rename a directory

    mv project project-old
  6. Move with find results

    find . -name "*.tmp" -exec mv -t /tmp/old {} +

mv guides

← All Linux commands · Suggest a fix

Back to top