MV(1)

NAME
mv - move or rename files

SYNOPSIS
mv [ - ] [ -fi ] filename1 filename2
mv [ - ] [ -fi ] directory1 directory2
mv [ - ] [ -fi ] filename ... directory

DESCRIPTION

mv moves files and directories around in the file system. A side effect of mv is to rename a file or directory. The three major forms of mv are shown in the synopsis above.

The first form of mv moves (changes the name of) filename1 to filename2. If filename2 already exists, it is removed before filename1 is moved. If filename2 has a mode which forbids writing, mv prints the mode (see chmod(2V)) and reads the standard input to obtain a line; if the line begins with y, the move takes place, otherwise mv exits.

The second form of mv moves (changes the name of) directory1 to directory2, only if directory2 does not already exist — if it does, the third form applies.

The third form of mv moves one or more filenames (may also be directories) with their original names, into the last directory in the list.

mv refuses to move a file or directory onto itself.

OPTIONS

-   Interpret all the following arguments to mv as file names. This allows file names starting with minus.

-f  Force. Override any mode restrictions and the -i option. The -f option also suppresses any warning messages about modes which would potentially restrict overwriting.

-i  Interactive mode. mv displays the name of the file or directory followed by a question mark whenever a move would replace an existing file or directory. If you type a line starting with y, mv moves the specified file or directory, otherwise mv does nothing with that file or directory.

SEE ALSO
cp(1), ln(1V), chmod(2V), rename(2V)

DIAGNOSTICS

mv: pathname: rename: Permission denied
    Attempted to move pathname into a directory that did not have write permission.

BUGS

If filename1 and filename2 are on different file systems, then mv must copy the file and delete the original. In this case the owner name becomes that of the copying process and any linking relationship with other files is lost.

Modification times may be different than expected when mv must copy the file's data, rather than simply updating a directory entry.

mv will not move a directory from one file system to another. Use cp(1) instead.