#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 會將<源>文件備份。
請向 <[email protected]> 報告錯誤。
#