DELAPARRA
Index
Color
NL
Category: CLI commands

mv

Explained by Updated

What is mv?

mv: Move / Rename — Move a file or rename it. mv moves or renames files and folders. mv old.txt new.txt renames a file, and mv report.pdf archive/ moves it into another folder. Within the same disk, moving is instant, because only the file's directory entry changes. Across disks, mv copies the data and then deletes the original.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about mv

What should you keep in mind with mv?

By default it overwrites an existing file at the destination without asking. mv -i asks first, and mv -n never overwrites. A useful trick for safe deploys is writing a new file under a temporary name and then using mv to replace the old one. On the same file system the replacement is atomic, so nothing ever reads a half-written file. In Git projects, git mv records the move so history follows the file.

At a glance

CategoryCLI commands
Explained by
Updated

More CLI commands terms

All terms starting with M

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.