Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 701 Bytes

linux-mv.md

File metadata and controls

32 lines (20 loc) · 701 Bytes

mv

This command is used to move or rename files.

To rename files:

mv [option] [original file] [new file]

So if you are in the directory documents with the file hello.txt, to rename it to newname.txt:

mv hello.txt newname.txt

If you simply want to move without renaming (in this case move to the directory music:

mv hello.txt music/.

In this case, the period . means to place the file here without renaming it. You can also move and rename in the same step:

mv hello.txt music/newname.txt

-i

If you are trying to rename a file to an existing name, this option causes the shell to prompt you for confirmation before overriding.