Move or rename files or directories.

mv [options]… Source Dest

mv [options]… Source… DirectoryIf the last argument names an existing directory, &qt;mv&qt;&qt; 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.


Make a backup of each file that would otherwise be overwritten or

Remove existing destination files and never prompt the user.

Prompt whether to overwrite each existing destination file,
regardless of its permissions. If the response does not begin
with &qt;y&qt;&qt; or &qt;Y&qt;&qt;, the file is skipped.

Append SUFFIX to each backup file made with &qt;-b&qt;&qt;.
The backup suffix is ~, unless set with SIMPLE_BACKUP_SUFFIX.

Do not move a nondirectory that has an existing destination with
the same or newer modification time.

Print the name of each file before moving it.

Change the type of backups made with &qt;-b&qt;&qt;. METHOD can be:

t, numbered make numbered backups
nil, existing numbered if numbered backups exist, simple otherwise
never, simple always make simple backups

–help display help and exit
–version output version information and exit


Rename the file apple as orange.doc:
mv apple orange.doc

Move orange.doc to the Documents folder:
mv orange.doc ~/Documents/orange.doc

Rename a bunch of file extensions
e.g. change *.txt into *.htm
for f in *.txt; do mv ./"$f" "${f&qt;txt}htm"; done&qt;mv&qt;&qt; can move only regular files across filesystems.

If a destination file exists but is normally unwritable, standard input is a terminal, and the &qt;-f&qt;&qt; or &qt;–force&qt;&qt; option is not given, &qt;mv&qt;&qt; prompts the user for whether to replace the file. (You might own the file, or have write permission on its directory.) If the response does not begin with &qt;y&qt;&qt; or &qt;Y&qt;&qt;, the file is skipped.