Commands · Command

CommandLinuxmacOS

mv

mv [options] source destination

Moves or renames a file or directory; unlike cp, the original isn't left behind.

// FLAGS

-iprompt before overwrite
-nnever overwrite an existing file
-vverbose

// EXAMPLE

mv notes.txt notes-old.txt — renames the file in place; there's no separate "rename" command on Linux/macOS.

// GOTCHA

mv overwrites an existing destination silently by default — no confirmation, no undo — unless -i is used.

// RELATED COMMANDS