#cp --Help
用法:cp [选项]... [-T] 源 目的
或:cp [选项]... 源... 目录
或:cp [选项]... -t 目录 源...
将<源>文件复制至<目的>,或将多个<源>复制至<目录>。
长选项必须用的参数在使用短选项时也是必须的。
-a, --archive 等于 -dpR
--backup[=CONTROL] 为每个已存在的目的地文件创建备份文件
-b 类似 --backup,但不接受任何参数
--copy-contents 当使用递归模式时复制特殊文件的内容
-d 等于 --no-dereference --preserve=link
-f, --force if an existing destination file cannot be
opened, remove it and try again
-i, --interactive prompt before overwrite
-H follow command-line symbolic links
-l, --link 链接文件而不复制
-L, --dereference 总是跟随符号链接
-P, --no-dereference 从不跟随符号链接
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST] preserve the specified attributes (default:
mode,ownership,timestamps), if possible
additional attributes: links, all
-c same as --preserve=context
--no-preserve=ATTR_LIST don't preserve the specified attributes
--parents use full source file name under DIRECTORY
-R, -r, --recursive 复制目录及目录内的所有项目
--remove-destination 尝试打开目的地文件前先删除已存在的目的地
文件 (与 --force 选项作对比)
--sparse=WHEN control creation of sparse files
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-s, --symbolic-link make symbolic links instead of copying
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY
-T, --no-target-directory treat DEST as a normal file
-u, --update copy 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
-x, --one-file-system stay on this file system
-Z, --context=CONTEXT set security context of copy to CONTEXT
--help 显示此帮助信息并退出
--version 输出版本信息并退出
默认使用模式中,<源>文件是否 sparse 文件会由一种粗略的方式决定,而且相应
的<目的地>文件也会是 sparse 文件。此方式等于使用 --sparse=auto 选项。指定
--sparse=always 则只要<源>文件含有足够长的 0 字节都会产生 sparse 的
<目的地>文件。
使用 --sparse=never 会禁止产生 sparse 文件。
备份文件的后缀为“~”,除非以 --suffix 选项或是 SIMPLE_BACKUP_SUFFIX
环境变量指定。版本控制的方式可透过 --backup 选项或 VERSION_CONTROL 环境
变量来选择。以下是可用的变量值:
none, off 不会进行备份 (即使使用了 --backup 选项)
numbered, t 备份文件会加上数字
existing, nil 若有数字的备份文件已经存在则使用数字,否则使用普通方式备份
simple, never 永远使用普通方式备份
有一个特别情况:如果同时指定 --force 和 --backup 选项,而且<源>和<目的地>
是同一个已存在的一般文件的话,cp 会将<源>文件备份。
请向 <bug-coreutils@gnu.org> 报告错误。
#