File and Folder Operations

mv

Moves or renames files and directories.

mv changes the path of a file. When source and destination are on the same filesystem, it is usually a fast rename operation.

Syntax
mv [options] source... destination

Arguments explained

  • source is the file or directory to move.
  • destination is the new path or target directory.
  • -i asks before overwriting.
  • -n avoids overwriting existing files.

Common examples

Rename a file
mv draft.txt final.txt

Changes the filename in the current directory.

Move files into a directory
mv *.log ~/logs/

Moves matching log files into ~/logs.

mv Command
FieldDetails
Commandmv
CategoryFile and Folder Operations
Primary useMoves or renames files and directories.
Syntaxmv [options] source... destination