mv - Move a file


mv file… [ target ]


Mv moves one or more files to another file or directory. The source file may be in another directory, in which case a path must be given. Mv is useful for renaming a file as well.

If the target is a directory, the source files are moved to files in the directory using their original filenames.

If the destination file does not exist, it is created, and the contents of the source files are moved.

If a source file is given, but no target file, the current working directory is assumed as the target area, preserving the original filename, though mv refuses to move a file to itself.


mv godel escher bach $/usr/mdavis

This moves three files from the current working directory to the directory $/usr/mdavis.

mv tycho brahe

In this example, “tycho” is simply renamed “brahe”. If “brahe” existed before mv was used, it is deleted before the name change is done.

See Also

add(C), cp(C)