mv – Move a file or a folder in Mac OS X

mv - Move a file or a folder in Mac OS X

Syntax:mv [-Options] <source> <target>

Usage/Result:Move a file or a folder to another location.


-nDo not overwrite existing files/folders.
-iConfirm every action that will overwrite another file or folder.
-fOverwrite existing files without prompting for it.
-vVerbose: Outputs the name of the files as they are being moved.


mv myfile.txt ~/DocumentsMoves myfile.txt to ~/Documents.
mv *.jpg /Data/PicturesMove all files in the current working dir that ends with .jpg to the /Data/Pictures directory.
mv Documents “My documents” Move the folder Documents to My documents. Quotes are needed since the target destination has spaces in it.

Quick tip

Sometimes you might not be able to perform a certain command or task from the Terminal. This might be because you don’t have the right permission to do so. When that happens you can try to add the word “sudo” in the beginning of the line.

Sudo is an abbreviation of superuser do and means that you want to execute the following command as a user with extended permissions, most often as an Administrator. When using “sudo” you sometimes need to enter the password of the root account.

MOre to read: Manage files and folders directly from the Terminal window in Mac OS X