Skip to content

The mv command

Move or rename files and directories. Moves SOURCE to DEST. In the same directory that is a rename. If the last name is an existing directory, the files move inside it. Folders move without needing -r. An existing file at DEST is replaced without asking.

Usage

mv [OPTION]... SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY

Options

-v, --verbosesay what was moved

Examples

  • mv draft.txt final.txtRename a file
  • mv *.png images/Move files into a folder
  • mv old-site archive/Move a whole folder

Learn it step by step

learner@sandbox: ~bash (practice)
Note: Try mv here: your home directory has sample files. Press Try beside an example, or type your own.

A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.