|
|
mv [ -fi ] source_file
mv [ -1 ] source_dir target_dir ... target_directory
If the destination file already exists, it is removed before source_file is copied. If the permissions of the destination file do not permit writing and the standard input is a terminal, or the -i option was specified, mv prints the destination pathname and the mode (see chmod(S)) and prompts for confirmation. If you type ``y'', the move takes place; otherwise mv does not move the file and continues to the next source_file.
In the second form, mv moves each source_file to a new destination directory. The destination path is formed for each file by concatenating the target_directory, a slash, and the basename of the source_file.
The -f option suppresses all prompting.
The third form operates on directories. If the -1 option is used, the source_dir replaces the target_dir (unless the target_dir is not empty). Without the -1 option, the source_dir becomes a subdirectory of the target_dir.
mv attempts to preserve the following characteristics of each file moved:
To move all the files in /tmp to the current directory:
mv /tmp/* .
To force mv to overwrite thisfile with
/tmp/thisfile (when moving /tmp/thisfile to the
current directory):
mv -f /tmp/thisfile thisfile
mv refuses to move a file onto itself.
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.