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