MV(1) | User Commands | MV(1) |
mv - move or rename files and directories
mv [-f] [-i] [-b size] file1 [file2 . . . ] target
Mv moves (changes the name of) file1 to target. If target is an existing regular file, its content is overwritten. Its mode and owner are preserved; the mode of the source file is used otherwise. If the mode of target forbids writing (and standard input is terminal for /usr/5bin/mv and /usr/5bin/s42/mv), 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; if not, the file is not moved.
If target is a directory, one or more files are copied into the directory with their original file-names.
Mv refuses to move a file onto itself.
The mv command accepts the following options:
The following option is an extension:
cp(1), cat(1), pr(1), unlink(2)
Use either
mv -- -file target
mv ./-file target
If source and target lie on different file systems, mv must copy the file and delete the original. In this case any linking relationship with other files is lost, but mv will preserve linkage inside the moved tree. Mv will try to preserve access and modification times, user and group ownerships, and file permission bits. Failing to preserve these modes is not considered an error, only /usr/5bin/posix/mv and /usr/5bin/posix2001/mv will print an error message. Special files such as block and character devices, FIFOs, and symbolic links are recreated in the target hierarchy.
The pathname contained in a symbolic link is not changed when the link is moved. Symbolic links with relative pathnames may thus change or lose their target if moved to a different level in the file hierarchy.
1/24/05 | Heirloom Toolchest |