
324
|
Chapter 3: Linux Commands
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
mv
mv [option] sources target
Move or rename files and directories. The source (first column) and
target (second column) determine the result (third column):
The mv command is often aliased as mv -i in the .bashrc file, espe-
cially for the root account, to prevent inadvertently overwriting
files.
Options
-b Back up files before removing.
--backup[=type]
Like -b, but can take an argument specifying the type of
version-control file to use for the backup. The value of type
overrides 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,
and make simple backups of the others. This is the
default.
never, simple
Always make simple backups.
none, off
Never make backups.
-f, --force
Force the move, even if target file exists; suppress messages
about restricted access modes. Same as --reply=yes.
--help
Print a help message and then exit.
-i, --interactive
Query user before removing files. Same as --reply=query.
--reply=prompt
Specify how to handle prompt if the destination exists already.
Possible values are yes, no, and query.
Source Target Result
File name (nonexistent) Rename file to name.
File