File Operations

mv

Move or rename files and directories.

Synopsis

syntax
mv [OPTION]... SOURCE... DEST

Examples

Rename a file
mv old.txt new.txt
Move all JPEG files to Pictures
mv *.jpg ~/Pictures/
Move directory with overwrite prompt
mv -i dir1/ dir2/
Move TypeScript files with verbose output
mv -v src/*.ts dist/

Common options

FlagDescription
-iPrompt before overwriting
-fForce overwrite without prompting
-vVerbose output
-nDo not overwrite existing files
-uMove only when source is newer

About mv

The `mv` command move or rename files and directories. File operation commands are essential for navigating and managing the Linux filesystem.

They form the backbone of everyday system administration and development workflows. Mastering these commands enables you to efficiently create, move, copy, and organize files and directories from the terminal, which is often faster and more scriptable than graphical alternatives.

The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man mv`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More File Operations Commands

Other commands in the File Operations category

Related tools