| 1 |
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.50.1. |
| 2 |
.TH CP "1" "June 2025" "GNU coreutils 9.7" "User Commands" |
| 3 |
.SH NAME |
| 4 |
cp \- copy files and directories |
| 5 |
.SH SYNOPSIS |
| 6 |
.B cp |
| 7 |
[\fI\,OPTION\/\fR]... [\fI\,-T\/\fR] \fI\,SOURCE DEST\/\fR |
| 8 |
.br |
| 9 |
.B cp |
| 10 |
[\fI\,OPTION\/\fR]... \fI\,SOURCE\/\fR... \fI\,DIRECTORY\/\fR |
| 11 |
.br |
| 12 |
.B cp |
| 13 |
[\fI\,OPTION\/\fR]... \fI\,-t DIRECTORY SOURCE\/\fR... |
| 14 |
.SH DESCRIPTION |
| 15 |
.\" Add any additional description here |
| 16 |
.PP |
| 17 |
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. |
| 18 |
.PP |
| 19 |
Mandatory arguments to long options are mandatory for short options too. |
| 20 |
.TP |
| 21 |
\fB\-a\fR, \fB\-\-archive\fR |
| 22 |
same as \fB\-dR\fR \fB\-\-preserve\fR=\fI\,all\/\fR |
| 23 |
.TP |
| 24 |
\fB\-\-attributes\-only\fR |
| 25 |
don't copy the file data, just the attributes |
| 26 |
.TP |
| 27 |
\fB\-\-backup\fR[=\fI\,CONTROL\/\fR] |
| 28 |
make a backup of each existing destination file |
| 29 |
.TP |
| 30 |
\fB\-b\fR |
| 31 |
like \fB\-\-backup\fR but does not accept an argument |
| 32 |
.TP |
| 33 |
\fB\-\-copy\-contents\fR |
| 34 |
copy contents of special files when recursive |
| 35 |
.TP |
| 36 |
\fB\-d\fR |
| 37 |
same as \fB\-\-no\-dereference\fR \fB\-\-preserve\fR=\fI\,links\/\fR |
| 38 |
.TP |
| 39 |
\fB\-\-debug\fR |
| 40 |
explain how a file is copied. Implies \fB\-v\fR |
| 41 |
.TP |
| 42 |
\fB\-f\fR, \fB\-\-force\fR |
| 43 |
if an existing destination file cannot be |
| 44 |
opened, remove it and try again (this option |
| 45 |
is ignored when the \fB\-n\fR option is also used) |
| 46 |
.TP |
| 47 |
\fB\-i\fR, \fB\-\-interactive\fR |
| 48 |
prompt before overwrite (overrides a previous \fB\-n\fR |
| 49 |
option) |
| 50 |
.TP |
| 51 |
\fB\-H\fR |
| 52 |
follow command\-line symbolic links in SOURCE |
| 53 |
.TP |
| 54 |
\fB\-l\fR, \fB\-\-link\fR |
| 55 |
hard link files instead of copying |
| 56 |
.TP |
| 57 |
\fB\-L\fR, \fB\-\-dereference\fR |
| 58 |
always follow symbolic links in SOURCE |
| 59 |
.TP |
| 60 |
\fB\-n\fR, \fB\-\-no\-clobber\fR |
| 61 |
(deprecated) silently skip existing files. |
| 62 |
See also \fB\-\-update\fR |
| 63 |
.TP |
| 64 |
\fB\-P\fR, \fB\-\-no\-dereference\fR |
| 65 |
never follow symbolic links in SOURCE |
| 66 |
.TP |
| 67 |
\fB\-p\fR |
| 68 |
same as \fB\-\-preserve\fR=\fI\,mode\/\fR,ownership,timestamps |
| 69 |
.TP |
| 70 |
\fB\-\-preserve\fR[=\fI\,ATTR_LIST\/\fR] |
| 71 |
preserve the specified attributes |
| 72 |
.TP |
| 73 |
\fB\-\-no\-preserve\fR=\fI\,ATTR_LIST\/\fR |
| 74 |
don't preserve the specified attributes |
| 75 |
.TP |
| 76 |
\fB\-\-parents\fR |
| 77 |
use full source file name under DIRECTORY |
| 78 |
.TP |
| 79 |
\fB\-R\fR, \fB\-r\fR, \fB\-\-recursive\fR |
| 80 |
copy directories recursively |
| 81 |
.TP |
| 82 |
\fB\-\-reflink\fR[=\fI\,WHEN\/\fR] |
| 83 |
control clone/CoW copies. See below |
| 84 |
.TP |
| 85 |
\fB\-\-remove\-destination\fR |
| 86 |
remove each existing destination file before |
| 87 |
attempting to open it (contrast with \fB\-\-force\fR) |
| 88 |
.TP |
| 89 |
\fB\-\-sparse\fR=\fI\,WHEN\/\fR |
| 90 |
control creation of sparse files. See below |
| 91 |
.TP |
| 92 |
\fB\-\-strip\-trailing\-slashes\fR |
| 93 |
remove any trailing slashes from each SOURCE |
| 94 |
argument |
| 95 |
.TP |
| 96 |
\fB\-s\fR, \fB\-\-symbolic\-link\fR |
| 97 |
make symbolic links instead of copying |
| 98 |
.TP |
| 99 |
\fB\-S\fR, \fB\-\-suffix\fR=\fI\,SUFFIX\/\fR |
| 100 |
override the usual backup suffix |
| 101 |
.TP |
| 102 |
\fB\-t\fR, \fB\-\-target\-directory\fR=\fI\,DIRECTORY\/\fR |
| 103 |
copy all SOURCE arguments into DIRECTORY |
| 104 |
.TP |
| 105 |
\fB\-T\fR, \fB\-\-no\-target\-directory\fR |
| 106 |
treat DEST as a normal file |
| 107 |
.TP |
| 108 |
\fB\-\-update\fR[=\fI\,UPDATE\/\fR] |
| 109 |
control which existing files are updated; |
| 110 |
UPDATE={all,none,none\-fail,older(default)} |
| 111 |
.TP |
| 112 |
\fB\-u\fR |
| 113 |
equivalent to \fB\-\-update\fR[=\fI\,older\/\fR]. See below |
| 114 |
.TP |
| 115 |
\fB\-v\fR, \fB\-\-verbose\fR |
| 116 |
explain what is being done |
| 117 |
.TP |
| 118 |
\fB\-\-keep\-directory\-symlink\fR |
| 119 |
follow existing symlinks to directories |
| 120 |
.TP |
| 121 |
\fB\-x\fR, \fB\-\-one\-file\-system\fR |
| 122 |
stay on this file system |
| 123 |
.TP |
| 124 |
\fB\-Z\fR |
| 125 |
set SELinux security context of destination |
| 126 |
file to default type |
| 127 |
.TP |
| 128 |
\fB\-\-context\fR[=\fI\,CTX\/\fR] |
| 129 |
like \fB\-Z\fR, or if CTX is specified then set the |
| 130 |
SELinux or SMACK security context to CTX |
| 131 |
.TP |
| 132 |
\fB\-\-help\fR |
| 133 |
display this help and exit |
| 134 |
.TP |
| 135 |
\fB\-\-version\fR |
| 136 |
output version information and exit |
| 137 |
.PP |
| 138 |
ATTR_LIST is a comma\-separated list of attributes. Attributes are 'mode' for |
| 139 |
permissions (including any ACL and xattr permissions), 'ownership' for user |
| 140 |
and group, 'timestamps' for file timestamps, 'links' for hard links, 'context' |
| 141 |
for security context, 'xattr' for extended attributes, and 'all' for all |
| 142 |
attributes. |
| 143 |
.PP |
| 144 |
By default, sparse SOURCE files are detected by a crude heuristic and the |
| 145 |
corresponding DEST file is made sparse as well. That is the behavior |
| 146 |
selected by \fB\-\-sparse\fR=\fI\,auto\/\fR. Specify \fB\-\-sparse\fR=\fI\,always\/\fR to create a sparse DEST |
| 147 |
file whenever the SOURCE file contains a long enough sequence of zero bytes. |
| 148 |
Use \fB\-\-sparse\fR=\fI\,never\/\fR to inhibit creation of sparse files. |
| 149 |
.PP |
| 150 |
UPDATE controls which existing files in the destination are replaced. |
| 151 |
\&'all' is the default operation when an \fB\-\-update\fR option is not specified, |
| 152 |
and results in all existing files in the destination being replaced. |
| 153 |
\&'none' is like the \fB\-\-no\-clobber\fR option, in that no files in the |
| 154 |
destination are replaced, and skipped files do not induce a failure. |
| 155 |
\&'none\-fail' also ensures no files are replaced in the destination, |
| 156 |
but any skipped files are diagnosed and induce a failure. |
| 157 |
\&'older' is the default operation when \fB\-\-update\fR is specified, and results |
| 158 |
in files being replaced if they're older than the corresponding source file. |
| 159 |
.PP |
| 160 |
When \fB\-\-reflink\fR[=\fI\,always\/\fR] is specified, perform a lightweight copy, where the |
| 161 |
data blocks are copied only when modified. If this is not possible the copy |
| 162 |
fails, or if \fB\-\-reflink\fR=\fI\,auto\/\fR is specified, fall back to a standard copy. |
| 163 |
Use \fB\-\-reflink\fR=\fI\,never\/\fR to ensure a standard copy is performed. |
| 164 |
.PP |
| 165 |
The backup suffix is '~', unless set with \fB\-\-suffix\fR or SIMPLE_BACKUP_SUFFIX. |
| 166 |
The version control method may be selected via the \fB\-\-backup\fR option or through |
| 167 |
the VERSION_CONTROL environment variable. Here are the values: |
| 168 |
.TP |
| 169 |
none, off |
| 170 |
never make backups (even if \fB\-\-backup\fR is given) |
| 171 |
.TP |
| 172 |
numbered, t |
| 173 |
make numbered backups |
| 174 |
.TP |
| 175 |
existing, nil |
| 176 |
numbered if numbered backups exist, simple otherwise |
| 177 |
.TP |
| 178 |
simple, never |
| 179 |
always make simple backups |
| 180 |
.PP |
| 181 |
As a special case, cp makes a backup of SOURCE when the force and backup |
| 182 |
options are given and SOURCE and DEST are the same name for an existing, |
| 183 |
regular file. |
| 184 |
.SH AUTHOR |
| 185 |
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering. |
| 186 |
.SH "REPORTING BUGS" |
| 187 |
GNU coreutils online help: <https://www.gnu.org/software/coreutils/> |
| 188 |
.br |
| 189 |
Report any translation bugs to <https://translationproject.org/team/> |
| 190 |
.SH "SEE ALSO" |
| 191 |
\fBinstall\fP(1) |
| 192 |
.PP |
| 193 |
.br |
| 194 |
Full documentation <https://www.gnu.org/software/coreutils/cp> |
| 195 |
.br |
| 196 |
or available locally via: info \(aq(coreutils) cp invocation\(aq |
| 197 |
.PP |
| 198 |
.br |
| 199 |
Packaged by Debian (9.7\-3) |
| 200 |
.br |
| 201 |
Copyright \(co 2025 Free Software Foundation, Inc. |
| 202 |
.br |
| 203 |
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. |
| 204 |
.br |
| 205 |
This is free software: you are free to change and redistribute it. |
| 206 |
.br |
| 207 |
There is NO WARRANTY, to the extent permitted by law. |