mv 命令详解
Linux -- mv 移动文件
MV(1) User Commands MV(1)
NAME 名称
mv - move (rename) files 移动(重命名)文件
SYNOPSIS 大纲(语法)
mv [OPTION]... [-T] SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY
mv [OPTION]... -t DIRECTORY SOURCE...
DESCRIPTION 说明
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
移动且修改源文件名到目标文件名,或移动多个文件到目标目录。
Mandatory arguments to long options are mandatory for short options too.
对于长选项必须的参数,对于短选项也是必须的。
--backup[=CONTROL]
make a backup of each existing destination file
对存在的目标文件作一备份。
-b
like --backup but does not accept an argument
同--backup,对存在的目标文件作一备份,但不接受参数。
-f, --force
do not prompt before overwriting
当目标文件存在时,直接覆盖,不给予提示。
-i, --interactive
prompt before overwrite
当目标文件存在时,给予提示。
-n, --no-clobber
do not overwrite an existing file
不覆盖存在的目标文件,即当目标文件存在时,不操作。
If you specify more than one of -i, -f, -n, only the final one takes effect.
当指定-i, -f, -n当中的两个或两个以上选项时,只有最后一个选项有效。
--strip-trailing-slashes
remove any trailing slashes from each SOURCE argument
删除源文件参数中最后的斜杠"/"。
-S, --suffix=SUFFIX
override the usual backup suffix
重新指定备份文件后缀。
-t, --target-directory=DIRECTORY
move all SOURCE arguments into DIRECTORY
移动所有文件到指定目录。
-T, --no-target-directory
treat DEST as a normal file
将目标目录作为普通文件
-u, --update
move only when the SOURCE file is newer than the destination file or when
the destination file is missing
如果目的地有相同名称的文件存在,以修改时间为参考,保留最新时间的文件,如果目的地没有相同名称的文件存在,则直接移动。
-v, --verbose
explain what is being done
显示当前进度。
-Z, --context
set SELinux security context of destination file to default type
--help
display this help and exit
显示此命令的帮助信息并退出。
--version
output version information and exit
显示版本信息并退出。
The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values:
除非设置了--suffix选项或SIMPLE_BACKUP_SUFFIX变量,否则使用'~'后缀。版本控制方式由--backup选项决定,或由VERSION_CONTROL环境变量决定。可选方式如下:
none, off
never make backups (even if --backup is given)
虽然给定--backup参数,但不生成备份文件,即不作备份
numbered, t
make numbered backups
生成编号备份文件
existing, nil
numbered if numbered backups exist, simple otherwise
如果存在编号备份文件,则使用编号备份文件,否则使用默认的备份方式
simple, never
always make simple backups
生成简易的备份文件,默认的备份方式
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report mv translation bugs to <http://translationproject.org/team/>
AUTHOR
Written by Mike Parker, David MacKenzie, and Jim Meyering.
COPYRIGHT
Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
rename(2)
The full documentation for mv is maintained as a Texinfo manual. If the info and mv programs are properly installed at your site, the command
info coreutils 'mv invocation'
should give you access to the complete manual.
mv的完整文档是以Texinfo手册形式维护的。如果info和mv程序都已经安装,那么执行命令:
info coreutils 'mv invocation'
应该会让你访问到整篇手册。
GNU coreutils 8.22 June 2014 MV(1)