Terminal Icon

Moving or renaming a file

You can move a file into a different directory, by using the mv command.

To move a file:

Enter:

mv myFile secondFile

myFile is the path and name of the first file, secondFile is the path and directory of the next file.

If you specify mv to move a file to a location and a file of the same name already exists there, mv deletes the existing file and overwrites it with the new file.

You can also use the mv command to rename a file. Renaming is just moving the contents of a file into a new file with a different name and then deleting the original file.

For more information on moving files, see the mv man page by entering man mv in the Terminal window.


Related Topics

UNIX

Open

man page for mv