Name

mv

Synopsis

                  mv [option] sources 
                  target
               

Move or rename files and directories. The source (first column) and target (second column) determine the result (third column):

Source

Target

Result

File

name (nonexistent)

Rename file to name.

File

Existing file

Overwrite existing file with source file.

Directory

name (nonexistent)

Rename directory to name.

Directory

Existing directory

Move directory to be a subdirectory of existing directory.

One or more files

Existing directory

Move files to directory.

Options

-b, --backup

Back up files before removing.

-f, --force

Force the move, even if target file exists; suppress messages about restricted access modes.

--help

Print a help message and then exit.

-i, --interactive

Query user before removing files.

-u, --update

Do not remove a file or link if its modification date is the same as or newer than that of its replacement.

-v, --verbose

Print the name of each file before moving it.

--version

Print version information and then exit.

-S suffix, --suffix= suffix

Override the SIMPLE_BACKUP_SUFFIX environment variable, which determines the suffix used for making simple backup files. If the suffix is not set either way, the default is a tilde (~).

-V value, --version-control= value

Override the VERSION_CONTROL environment variable, which determines the type of backups made. The acceptable values for version control are:

t, numbered

Always make numbered backups.

nil, existing

Make numbered backups of files that already have them, ...

Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.