1CP(1) User Commands CP(1)
2
3
4
6 cp - copy files and directories
7
9 cp [OPTION]... [-T] SOURCE DEST
10 cp [OPTION]... SOURCE... DIRECTORY
11 cp [OPTION]... -t DIRECTORY SOURCE...
12
14 Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
15
16 Mandatory arguments to long options are mandatory for short options
17 too.
18
19 -a, --archive
20 same as -dR --preserve=all
21
22 --backup[=CONTROL]
23 make a backup of each existing destination file
24
25 -b like --backup but does not accept an argument
26
27 --copy-contents
28 copy contents of special files when recursive
29
30 -d same as --no-dereference --preserve=links
31
32 -f, --force
33 if an existing destination file cannot be opened, remove it and
34 try again (redundant if the -n option is used)
35
36 -i, --interactive
37 prompt before overwrite (overrides a previous -n option)
38
39 -H follow command-line symbolic links in SOURCE
40
41 -l, --link
42 link files instead of copying
43
44 -L, --dereference
45 always follow symbolic links in SOURCE
46
47 -n, --no-clobber
48 do not overwrite an existing file (overrides a previous -i
49 option)
50
51 -P, --no-dereference
52 never follow symbolic links in SOURCE
53
54 -p same as --preserve=mode,ownership,timestamps
55
56 --preserve[=ATTR_LIST]
57 preserve the specified attributes (default: mode,ownership,time‐
58 stamps), if possible additional attributes: context, links,
59 xattr, all
60
61 -c same as --preserve=context
62
63 --no-preserve=ATTR_LIST
64 don't preserve the specified attributes
65
66 --parents
67 use full source file name under DIRECTORY
68
69 -R, -r, --recursive
70 copy directories recursively
71
72 --reflink[=WHEN]
73 control clone/CoW copies. See below
74
75 --remove-destination
76 remove each existing destination file before attempting to open
77 it (contrast with --force)
78
79 --sparse=WHEN
80 control creation of sparse files. See below
81
82 --strip-trailing-slashes
83 remove any trailing slashes from each SOURCE argument
84
85 -s, --symbolic-link
86 make symbolic links instead of copying
87
88 -S, --suffix=SUFFIX
89 override the usual backup suffix
90
91 -t, --target-directory=DIRECTORY
92 copy all SOURCE arguments into DIRECTORY
93
94 -T, --no-target-directory
95 treat DEST as a normal file
96
97 -u, --update
98 copy only when the SOURCE file is newer than the destination
99 file or when the destination file is missing
100
101 -v, --verbose
102 explain what is being done
103
104 -x, --one-file-system
105 stay on this file system
106
107 -Z, --context=CONTEXT
108 set security context of copy to CONTEXT
109
110 --help display this help and exit
111
112 --version
113 output version information and exit
114
115 By default, sparse SOURCE files are detected by a crude heuristic and
116 the corresponding DEST file is made sparse as well. That is the behav‐
117 ior selected by --sparse=auto. Specify --sparse=always to create a
118 sparse DEST file whenever the SOURCE file contains a long enough
119 sequence of zero bytes. Use --sparse=never to inhibit creation of
120 sparse files.
121
122 When --reflink[=always] is specified, perform a lightweight copy, where
123 the data blocks are copied only when modified. If this is not possible
124 the copy fails, or if --reflink=auto is specified, fall back to a stan‐
125 dard copy.
126
127 The backup suffix is `~', unless set with --suffix or SIM‐
128 PLE_BACKUP_SUFFIX. The version control method may be selected via the
129 --backup option or through the VERSION_CONTROL environment variable.
130 Here are the values:
131
132 none, off
133 never make backups (even if --backup is given)
134
135 numbered, t
136 make numbered backups
137
138 existing, nil
139 numbered if numbered backups exist, simple otherwise
140
141 simple, never
142 always make simple backups
143
144 As a special case, cp makes a backup of SOURCE when the force and
145 backup options are given and SOURCE and DEST are the same name for an
146 existing, regular file.
147
149 Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
150
152 Report cp bugs to bug-coreutils@gnu.org
153 GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
154 General help using GNU software: <http://www.gnu.org/gethelp/>
155 Report cp translation bugs to <http://translationproject.org/team/>
156
158 Copyright © 2010 Free Software Foundation, Inc. License GPLv3+: GNU
159 GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
160 This is free software: you are free to change and redistribute it.
161 There is NO WARRANTY, to the extent permitted by law.
162
164 The full documentation for cp is maintained as a Texinfo manual. If
165 the info and cp programs are properly installed at your site, the com‐
166 mand
167
168 info coreutils 'cp invocation'
169
170 should give you access to the complete manual.
171
172
173
174GNU coreutils 8.5 November 2010 CP(1)