utility

mv

Rename or move an object. May overwrite destinations; cross-filesystem moves can require copying and removing.

Formal Syntax & Structure

bash syntaxbash
mv [OPTION] SOURCE DEST

Parameters & Attributes

NameTypeDescription
SOURCEpathSource path.
DESTpathDestination path.

Return Value

exit status

Exit status 0 on success; nonzero indicates failure or a command-specific condition. See description and example.

Working Example

Example Snippetbash
mkdir -- reportsprintf 'ready\n' > reports/draft.txtmv -- reports/draft.txt 'reports/final report.txt'cat -- 'reports/final report.txt'
Bash Reference