cp.1 (5562B)
1 .\" 2 .\" Sccsid @(#)cp.1 1.26 (gritter) 5/3/05 3 .\" Parts taken from cp(1), Unix 7th edition: 4 .\" Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. 5 .\" 6 .\" Redistribution and use in source and binary forms, with or without 7 .\" modification, are permitted provided that the following conditions 8 .\" are met: 9 .\" Redistributions of source code and documentation must retain the 10 .\" above copyright notice, this list of conditions and the following 11 .\" disclaimer. 12 .\" Redistributions in binary form must reproduce the above copyright 13 .\" notice, this list of conditions and the following disclaimer in the 14 .\" documentation and/or other materials provided with the distribution. 15 .\" All advertising materials mentioning features or use of this software 16 .\" must display the following acknowledgement: 17 .\" This product includes software developed or owned by Caldera 18 .\" International, Inc. 19 .\" Neither the name of Caldera International, Inc. nor the names of 20 .\" other contributors may be used to endorse or promote products 21 .\" derived from this software without specific prior written permission. 22 .\" 23 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA 24 .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR 25 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 .\" ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE 28 .\" LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 33 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 34 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 .TH CP 1 "5/3/05" "Heirloom Toolchest" "User Commands" 36 .SH NAME 37 cp \- copy files 38 .SH SYNOPSIS 39 \fBcp\fR 40 [\fB\-adDfiHLpPrRs\fR] [\fB\-b\ \fIsize\fR] 41 \fIfile1\fR [\fIfile2\fR .\ .\ .\ ] \fItarget\fR 42 .SH DESCRIPTION 43 .I File1 44 is copied onto 45 .IR target . 46 If 47 .I target 48 is an existing regular file, 49 its content is overwritten. 50 Its mode and owner are preserved; 51 the mode of the source file is used otherwise. 52 .PP 53 If 54 .I target 55 is a directory, 56 one or more files are copied 57 into the directory with their original file-names. 58 .PP 59 .I Cp 60 refuses to copy a file onto itself. 61 .PP 62 The 63 .I cp 64 command accepts the following options: 65 .TP 66 .B \-i 67 .I Cp 68 will ask for confirmation 69 before overwriting an existing target file. 70 For 71 .B /usr/5bin/cp 72 and 73 .BR /usr/5bin/s42/cp , 74 .I cp 75 will also ask for confirmation before overwriting a directory 76 with the 77 .I \-r 78 or 79 .I \-R 80 option. 81 For 82 .BR /usr/5bin/cp , 83 this flag will be automatically disabled 84 if standard input is not a terminal. 85 .TP 86 .B \-p 87 .I Cp 88 will try to preserve access and modification times, 89 user and group ownerships, 90 and file permission bits. 91 Failing to preserve these modes 92 is always considered an error, 93 but only 94 .BR /usr/5bin/s42/cp , 95 .BR /usr/5bin/posix2001/cp , 96 and 97 .B /usr/5bin/posix/cp 98 will print an error message. 99 .TP 100 .B \-r 101 The source file operands may be directories 102 that will be copied recursively. 103 Symbolic links are followed. 104 The content of all non-directory files encountered 105 is tried to be reproduced in a regular file. 106 .PP 107 The following options have been added by POSIX.2: 108 .TP 109 .B \-f 110 If overwriting a target file fails, 111 .I cp 112 will try to unlink that file and proceed. 113 .TP 114 .B \-R 115 The source file operands may be directories 116 that will be copied recursively. 117 Special files 118 such as block and character devices, 119 FIFOs, 120 and symbolic links encountered during traversal 121 are recreated in the target hierarchy. 122 If a symbolic link is given as an operand, 123 its target is copied. 124 .PP 125 The following options have been added by POSIX.1-2001: 126 .TP 127 .B \-H 128 With the 129 .I \-R 130 option, follow symbolic links given as operands, 131 but do not follow symbolic links encountered during traversal 132 of the source hierarchy. 133 This is the default. 134 .TP 135 .B \-L 136 With the 137 .I \-R 138 option, follow all symbolic links. 139 .TP 140 .B \-P 141 With the 142 .I \-R 143 option, do not follow any symbolic links. 144 .PP 145 The following options are extensions: 146 .TP 147 .B \-a 148 Perform a recursive copy and, if possible, 149 preserve hard links as well as any attributes. 150 This is the same as the combination of the 151 .I \-Rdp 152 options. 153 .TP 154 \fB\-b\ \fIsize\fR 155 With this option given, 156 .I cp 157 performs input and output in units of 158 .I size 159 bytes. 160 The default size depends on the current input file. 161 .TP 162 .B \-d 163 With the 164 .I \-r 165 or 166 .I \-R 167 options, 168 hard links between copied files are usually splitted, 169 i.\|e. each copied file is assigned to a separate i-node. 170 When this option is given, 171 hard links between copied files 172 are reproduced in the destination hierarchy. 173 .TP 174 .B \-D 175 Causes 176 .I cp 177 to use direct i/o 178 when copying file data. 179 See the description of `O_DIRECT' in 180 .IR open (2) 181 for more information. 182 .TP 183 .B \-s 184 With this option, 185 .I cp 186 prints i/o statistics for each single file 187 of which data was copied. 188 .SH "SEE ALSO" 189 cat(1), 190 cpio(1), 191 mv(1), 192 pr(1), 193 rm(1) 194 .SH NOTES 195 Use either 196 .RS 197 .sp 198 .B cp 199 .B \-\- 200 .I \-file 201 .I target 202 .sp 203 .RE 204 or 205 .RS 206 .sp 207 .B cp 208 .I ./\-file 209 .I target 210 .sp 211 .RE 212 to copy files that begin with a hyphen character. 213 .PP 214 A copy of a symbolic link 215 contains the same pathname as the original. 216 Symbolic links with relative pathnames 217 may thus change or lose their target 218 if copied to a different level in the file hierarchy.