mv(1)
NAME
mv − move files
SYNOPSIS
mv [ −f ] [ −i ] filename1 [ filename2 ...] target
AVAILABILITY
SUNWcsu
DESCRIPTION
The mv command moves filenamen to target. filenamen and target may not have the same name. (Care must be taken when using sh(1) metacharacters). If target is not a directory, only one file may be specified before it; if it is a directory, more than one file may be specified. If target does not exist, mv creates a file named target. If target exists and is not a directory, its contents are overwritten. If target is a directory the file(s) are moved to that directory.
If mv determines that the mode of target forbids writing, it will print the mode (see chmod(2)), ask for a response, and read the standard input for one line. If the line begins with y, the mv occurs, if permissible; otherwise, the command exits. When the parent directory of filenamen is writable and has the sticky bit set, one or more of the following conditions must be true:
the user must own the file
the user must own the directory
the file must be writable by the user
the user must be a privileged user
If filenamen is a directory, target must be a directory in the same physical file system. target and filenamen do not have to share the same parent directory.
If filenamen is a file and target is a link to another file with links, the other links remain and target becomes a new file.
OPTIONS
−f mv will move the file(s) without prompting even if it is writing over an existing target. This option overrides the −i option. Note that this is the default if the standard input is not a terminal.
−i mv will prompt for confirmation whenever the move would overwrite an existing target . A y answer means that the move should proceed. Any other answer prevents mv from overwriting the target.
ENVIRONMENT
If any of the LC_∗ variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5)) are not set in the environment, the operational behavior of mv for each corresponding locale category is determined by the value of the LANG environment variable. If LC_ALL is set, its contents are used to override both the LANG and the other LC_∗ variables. If none of the above variables is set in the environment, the "C" (U.S. style) locale determines how mv behaves.
LC_CTYPE
Determines how mv handles characters. When LC_CTYPE is set to a valid value, mv can display and handle text and filenames containing valid characters for that locale. mv can display and handle Extended Unix Code (EUC) characters where any individual character can be 1, 2, or 3 bytes wide. mv can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid.
LC_MESSAGES
Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses. In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English).
SEE ALSO
chmod(1), cp(1), cpio(1), ln(1), rm(1), environ(5)
NOTES
If filenamen and target are on different file systems, mv copies the file and deletes the original; any links to other files are lost.
A −− permits the user to mark explicitly the end of any command line options, allowing mv to recognize filename arguments that begin with a −. As an aid to BSD migration, mv will accept − as a synonym for −−. This migration aid may disappear in a future release. If a −− and a − both appear on the same command line, the second will be interpreted as a filename.
SunOS 5.4 — Last change: 14 Sep 1992