mv moves or renames files (or directories). Synopses:
mv [option]... [-T] source dest mv [option]... source... directory mv [option]... -t directory source...
mv can move any type of file from one file system to another.
Prior to version
4.0 of the fileutils,
mv could move only regular files between file systems.
For example, now mv can move an entire directory hierarchy
including special device files from one partition to another. It first
uses some of the same code that's used by
cp -a to copy the
requested directories and files, then (assuming the copy succeeded)
it removes the originals. If the copy fails, then the part that was
copied to the destination partition is removed. If you were to copy
three directories from one partition to another and the copy of the first
directory succeeded, but the second didn't, the first would be left on
the destination partition and the second and third would be left on the
mv always tries to copy extended attributes (xattr), which may include SELinux context, ACLs or Capabilities. Upon failure all but ‘Operation not supported’ warnings are output.
If a destination file exists but is normally unwritable, standard input is a terminal, and the -f or --force option is not given, mv prompts the user for whether to replace the file. (You might own the file, or have write permission on its directory.) If the response is not affirmative, the file is skipped.
Warning: Avoid specifying a source name with a trailing slash,
when it might be a symlink to a directory.
Otherwise, mv may do something very surprising, since
its behavior depends on the underlying rename system call.
On a system with a modern Linux-based kernel, it fails with
However, on other systems (at least FreeBSD 6.1 and Solaris 10) it silently
renames not the symlink but rather the directory referenced by the symlink.
See Trailing slashes.
The program accepts the following options. Also see Common options.
An exit status of zero indicates success, and a nonzero value indicates failure.