MV(1) MV(1) NAME mv - move (rename) files SYNOPSIS mv [option...] source target mv [option...] source... target POSIX options: [-fi] [--] GNU options (shortest form): [-bfiuv] [-S suffix] [-V {numbered,exist- ing,simple}] [--help] [--version] [--] DESCRIPTION mv moves or renames files or directories. If the last argument names an existing directory, mv moves each other given file into a file with the same name in that directory. Otherwise, if only two files are given, it renames the first as the second. It is an error if the last argument is not a directory and more than two files are given. Thus, `mv /a/x/y /b' will rename the file /a/x/y into /b/y if /b was an existing directory, and into /b otherwise. Let us call the file a given file is going to be moved into its desti- nation. If destination exists, and either the -i option is given, or destination is unwritable, standard input is a terminal, and the -f option is not given, mv prompts the user for whether to replace the file, writing a question to stderr and reading an answer from stdin. If the response is not affirmative, the file is skipped. When both source and destination are on the same filesystem, they are the same file (just the name is changed; owner, mode, timestamps remain unchanged). When they are on different filesystems, the source file is copied and then deleted. mv will copy modification time, access time, user and group ID, and mode if possible. When copying user and/or group ID fails, the setuid and setgid bits are cleared in the copy. POSIX OPTIONS -f Do not prompt for confirmation. -i Prompt for confirmation when destination exists. (In case both -f and -i are given, the last one given takes effect.) -- Terminate option list. GNU DETAILS The GNU implementation (in fileutils-3.16) is broken in the sense that mv can move only regular files across filesystems. GNU OPTIONS -f, --force Remove existing destination files and never prompt the user. -i, --interactive Prompt whether to overwrite existing regular destination files. If the response is not affirmative, the file is skipped. -u, --update Do not move a nondirectory that has an existing destination with the same or newer modification time. -v, --verbose Print the name of each file before moving it. GNU BACKUP OPTIONS The GNU versions of programs like cp, mv, ln, install and patch will make a backup of files about to be overwritten, changed or destroyed if that is desired. That backup files are desired is indicated by the -b option. How they should be named is specified by the -V option. In case the name of the backup file is given by the name of the file extended by a suffix, this suffix is specified by the -S option. -b, --backup Make backups of files that are about to be overwritten or removed. -S SUFFIX, --suffix=SUFFIX Append SUFFIX to each backup file made. If this option is not specified, the value of the SIMPLE_BACKUP_SUFFIX environment variable is used. And if SIMPLE_BACKUP_SUFFIX is not set, the default is `~'. -V METHOD, --version-control=METHOD Specify how backup files are named. The METHOD argument can be `numbered' (or `t'), `existing' (or `nil'), or `never' (or `sim- ple'). If this option is not specified, the value of the VER- SION_CONTROL environment variable is used. And if VERSION_CON- TROL is not set, the default backup type is `existing'. This option corresponds to the Emacs variable `version-control'. The valid METHODs are (unique abbreviations are accepted): t, numbered Always make numbered backups. nil, existing Make numbered backups of files that already have them, simple backups of the others. never, simple Always make simple backups. GNU STANDARD OPTIONS --help Print a usage message on standard output and exit successfully. --version Print version information on standard output, then exit success- fully. -- Terminate option list. ENVIRONMENT The variables LANG, LC_ALL, LC_COLLATE, LC_CTYPE and LC_MESSAGES have the usual meaning. For the GNU version, the variables SIM- PLE_BACKUP_SUFFIX and VERSION_CONTROL control backup file naming, as described above. CONFORMING TO POSIX 1003.2, except that directory hierarchies cannot be moved across filesystems. NOTES This page describes mv as found in the fileutils-4.0 package; other versions may differ slightly. Mail corrections and additions to aeb@cwi.nl. Report bugs in the program to fileutils- bugs@gnu.ai.mit.edu. GNU fileutils 4.0 1998-11 MV(1)