MV(1) — User’s Manual — Commands
NAME
mv − move or rename files
SYNOPSIS
mv [ −i ] [ −f ] [ − ] file1 file2
mv [ −i ] [ −f ] [ − ] directory1 directory2
mv [ −i ] [ −f ] [ − ] file ... directory ... 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) file1 to file2. If file2 already exists, it is removed before file1 is moved. If file2 has a mode which forbids writing, mv prints the mode (see chmod(2)) 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 files and directories, with their original names, to the last directory in the list.
Mv refuses to move a file or directory onto itself.
OPTIONS
−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.
−f force: override any mode restrictions and the −i switch. The −f option also suppresses any warning messages about modes which would potentially restrict overwriting.
− Interpret all the following arguments to mv as file names. This allows file names starting with minus.
SEE ALSO
Sun System Release 0.3 — 6 April 1983