mv moves a file to a new location. The same command renames: a rename is just a move to a new name in the same place. Here I rename newcopy, the copy from topic 3:
$ mv newcopy renamed
$ ls
backup
renamed
somedir
| Command | Does |
|---|---|
mv myfile /tmp | moves myfile to /tmp |
mv somefiles /tmp | moves a directory, with its content (no -r needed) |
mv myfile mynewfile | renames |
Footnote: the book says mv is “nothing else than copying and deleting”. That’s true when you move between different filesystems. On the same filesystem, mv only changes the name and location record, so it’s instant, even for a huge file.