3.1.17. mv - move files/folders from one place to another.#

  • Both are performed with mv

  • Follows the same notation as cp

  • Does not require the option, -r !!

mv [source] [destination]
  • [source] can be a file, folder, /path/to/file, or /path/to/folder

  • [destination] can be /path/to/file, or /path/to/folder with NewFileName or NewFolderName

3.1.17.1. Move/Rename Files and Folders#

  • Moving a file is straightforward; you can even rename it at the destination

# Move file.txt to the folder, destination, in /path/to, and rename it to newname.txt
mv file.txt /path/to/destination/newname.txt
  • Same for folders

mv directory path/to/destination/newname

mv is similar to cp, but it deletes the source. mv is also useful for renaming files!

mv source.txt new.txt