Print this page
1154 cpio needs a quiet option
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/cpio.1
+++ new/usr/src/man/man1/cpio.1
1 1 '\" te
2 2 .\" Copyright 1989 AT&T
3 3 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
4 +.\" Copyright (c) 2012 Gary Mills
4 5 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
6 7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text
7 8 .\" are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical
8 9 .\" and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 10 .\" This notice shall appear on any product containing this material.
10 11 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
11 12 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
12 13 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 14 .TH CPIO 1 "Aug 3, 2009"
14 15 .SH NAME
15 16 cpio \- copy file archives in and out
16 17 .SH SYNOPSIS
17 18 .LP
18 19 .nf
19 -\fBcpio\fR \fB-i\fR [\fB-bBcdfkmPrsStuvV6@/\fR] [\fB-C\fR \fIbufsize\fR] [\fB-E\fR \fIfile\fR]
20 +\fBcpio\fR \fB-i\fR [\fB-bBcdfkmPqrsStuvV6@/\fR] [\fB-C\fR \fIbufsize\fR] [\fB-E\fR \fIfile\fR]
20 21 [\fB-H\fR \fIheader\fR] [\fB-I\fR \fI\fR [\fB-M\fR \fImessage\fR]] [\fB-R\fR \fIid\fR] [\fIpattern\fR]...
21 22 .fi
22 23
23 24 .LP
24 25 .nf
25 -\fBcpio\fR \fB-o\fR [\fB-aABcLPvV@/\fR] [\fB-C\fR \fIbufsize\fR] [\fB-H\fR \fIheader\fR]
26 +\fBcpio\fR \fB-o\fR [\fB-aABcLPqvV@/\fR] [\fB-C\fR \fIbufsize\fR] [\fB-H\fR \fIheader\fR]
26 27 [\fB-O\fR \fIfile\fR [\fB-M\fR \fImessage\fR]]
27 28 .fi
28 29
29 30 .LP
30 31 .nf
31 -\fBcpio\fR \fB-p\fR [\fB-adlLmPuvV@/\fR] [\fB-R\fR \fIid\fR] \fIdirectory\fR
32 +\fBcpio\fR \fB-p\fR [\fB-adlLmPquvV@/\fR] [\fB-R\fR \fIid\fR] \fIdirectory\fR
32 33 .fi
33 34
34 35 .SH DESCRIPTION
35 36 .sp
36 37 .LP
37 38 The \fBcpio\fR command copies files into and out of a \fBcpio\fR archive. The
38 39 \fBcpio\fR archive can span multiple volumes. The \fB-i\fR, \fB-o\fR, and
39 40 \fB-p\fR options select the action to be performed. The following list
40 41 describes each of the actions. These actions are mutually exclusive.
41 42 .SS "Copy In Mode"
42 43 .sp
43 44 .LP
44 45 \fBcpio\fR \fB-i\fR (copy in) extracts files from the standard input, which is
45 46 assumed to be the product of a previous \fBcpio\fR \fB-o\fR command. Only files
46 47 with names that match one of the \fIpattern\fRs are selected. See \fBsh\fR(1)
47 48 and OPERANDS for more information about \fIpattern\fR. Extracted files are
48 49 conditionally copied into the current directory tree, based on the options
49 50 described below. The permissions of the files are those of the previous \fBcpio
50 51 -o\fR command. The owner and group are the same as the current user, unless the
51 52 current user has the \fB{PRIV_FILE_CHOWN_SELF}\fR privilege. See
52 53 \fBchown\fR(2). If this is the case, owner and group are the same as those
53 54 resulting from the previous \fBcpio -o\fR command. Notice that if \fBcpio\fR
54 55 \fB-i\fR tries to create a file that already exists and the existing file is
55 56 the same age or younger (\fBnewer\fR), \fBcpio\fR outputs a warning message and
56 57 not replace the file. The \fB-u\fR option can be used to unconditionally
57 58 overwrite the existing file.
58 59 .SS "Copy Out Mode"
59 60 .sp
60 61 .LP
61 62 \fBcpio\fR \fB-o\fR (copy out) reads a list of file path names from the
62 63 standard input and copies those files to the standard output, together with
63 64 path name and status information in the form of a \fBcpio\fR archive. Output is
64 65 padded to an 8192-byte boundary by default or to the user-specified block size
65 66 (with the \fB-B\fR or \fB-C\fR options) or to some device-dependent block size
66 67 where necessary (as with the CTC tape).
67 68 .SS "Pass Mode"
68 69 .sp
69 70 .LP
70 71 \fBcpio\fR \fB-p\fR (pass) reads a list of file path names from the standard
71 72 input and conditionally copies those files into the destination directory tree,
72 73 based on the options described below.
73 74 .sp
74 75 .LP
75 76 If the underlying file system of the source file supports detection of holes as
76 77 reported by \fBpathconf\fR(2), the file is a sparse file, and the destination
77 78 file is seekable, then holes in sparse files are preserved in pass mode,
78 79 otherwise holes are filled with zeros.
79 80 .sp
80 81 .LP
81 82 \fBcpio\fR assumes four-byte words.
82 83 .sp
83 84 .LP
84 85 If, when writing to a character device (\fB-o\fR) or reading from a character
85 86 device (\fB-i\fR), \fBcpio\fR reaches the end of a medium (such as the end of a
86 87 diskette), and the \fB-O\fR and \fB-I\fR options are not used, \fBcpio\fR
87 88 prints the following message:
88 89 .sp
89 90 .in +2
90 91 .nf
91 92 To continue, type device/file name when ready.
92 93 .fi
93 94 .in -2
94 95 .sp
95 96
96 97 .sp
97 98 .LP
98 99 To continue, you must replace the medium and type the character special device
99 100 name (\fB/dev/rdiskette\fR for example) and press RETURN. You might want to
100 101 continue by directing \fBcpio\fR to use a different device. For example, if you
101 102 have two floppy drives you might want to switch between them so \fBcpio\fR can
102 103 proceed while you are changing the floppies. Press RETURN to cause the
103 104 \fBcpio\fR process to exit.
104 105 .SH OPTIONS
105 106 .sp
106 107 .LP
107 108 The following options are supported:
108 109 .sp
109 110 .ne 2
110 111 .na
111 112 \fB\fB-i\fR\fR
112 113 .ad
113 114 .RS 6n
114 115 (copy in) Reads an archive from the standard input and conditionally extracts
115 116 the files contained in it and places them into the current directory tree.
116 117 .RE
117 118
118 119 .sp
119 120 .ne 2
120 121 .na
121 122 \fB\fB-o\fR\fR
122 123 .ad
123 124 .RS 6n
124 125 (copy out) Reads a list of file path names from the standard input and copies
125 126 those files to the standard output in the form of a \fBcpio\fR archive.
126 127 .RE
127 128
128 129 .sp
129 130 .ne 2
130 131 .na
131 132 \fB\fB-p\fR\fR
132 133 .ad
133 134 .RS 6n
134 135 (pass) Reads a list of file path names from the standard input and
135 136 conditionally copies those files into the destination directory tree.
136 137 .RE
137 138
138 139 .sp
139 140 .LP
140 141 The following options can be appended in any sequence to the \fB-i\fR,
141 142 \fB-o\fR, or \fB-p\fR options:
142 143 .sp
143 144 .ne 2
144 145 .na
145 146 \fB\fB-a\fR\fR
146 147 .ad
147 148 .RS 14n
148 149 Resets access times of input files after they have been copied, making
149 150 \fBcpio\fR's access invisible. Access times are not reset for linked files when
150 151 \fBcpio\fR \fB-pla\fR is specified.
151 152 .RE
152 153
153 154 .sp
154 155 .ne 2
155 156 .na
156 157 \fB\fB-A\fR\fR
157 158 .ad
158 159 .RS 14n
159 160 Appends files to an archive. The \fB-A\fR option requires the \fB-O\fR option.
160 161 Valid only with archives that are files, or that are on floppy diskettes or
161 162 hard disk partitions. The effect on files that are linked in the existing
162 163 portion of the archive is unpredictable.
163 164 .RE
164 165
165 166 .sp
166 167 .ne 2
167 168 .na
168 169 \fB\fB-b\fR\fR
169 170 .ad
170 171 .RS 14n
171 172 Reverses the order of the bytes within each word. Use only with the \fB-i\fR
172 173 option.
173 174 .RE
174 175
175 176 .sp
176 177 .ne 2
177 178 .na
178 179 \fB\fB-B\fR\fR
179 180 .ad
180 181 .RS 14n
181 182 Blocks input/output 5120 bytes to the record. The default buffer size is 8192
182 183 bytes when this and the \fB-C\fR options are not used. \fB-B\fR does not apply
183 184 to the \fB-p\fR (pass) option.
184 185 .RE
185 186
186 187 .sp
187 188 .ne 2
188 189 .na
189 190 \fB\fB-c\fR\fR
190 191 .ad
191 192 .RS 14n
192 193 Reads or writes header information in \fBASCII\fR character form for
193 194 portability. There are no \fBUID\fR or \fBGID\fR restrictions associated with
194 195 this header format. Use this option between SVR4-based machines, or the
195 196 \fB-H\fR \fBodc\fR option between unknown machines. The \fB-c\fR option implies
196 197 the use of expanded device numbers, which are only supported on SVR4-based
197 198 systems. When transferring files between SunOS 4 or Interactive UNIX and the
198 199 Solaris 2.6 Operating environment or compatible versions, use \fB-H\fR
199 200 \fBodc\fR.
200 201 .RE
201 202
202 203 .sp
203 204 .ne 2
204 205 .na
205 206 \fB\fB-C\fR \fIbufsize\fR\fR
206 207 .ad
207 208 .RS 14n
208 209 Blocks input/output \fIbufsize\fR bytes to the record, where \fIbufsize\fR is
209 210 replaced by a positive integer. The default buffer size is 8192 bytes when this
210 211 and \fB-B\fR options are not used. \fB-C\fR does not apply to the \fB-p\fR
211 212 (pass) option.
212 213 .RE
213 214
214 215 .sp
215 216 .ne 2
216 217 .na
217 218 \fB\fB-d\fR\fR
218 219 .ad
219 220 .RS 14n
220 221 Creates directories as needed.
221 222 .RE
222 223
223 224 .sp
224 225 .ne 2
225 226 .na
226 227 \fB\fB-E\fR \fIfile\fR\fR
227 228 .ad
228 229 .RS 14n
229 230 Specifies an input file (\fIfile\fR) that contains a list of filenames to be
230 231 extracted from the archive (one filename per line).
231 232 .RE
232 233
233 234 .sp
234 235 .ne 2
235 236 .na
236 237 \fB\fB-f\fR\fR
237 238 .ad
238 239 .RS 14n
239 240 Copies in all files except those in \fIpattern\fRs. See OPERANDS for a
240 241 description of \fIpattern\fR.
241 242 .RE
242 243
243 244 .sp
244 245 .ne 2
245 246 .na
246 247 \fB\fB-H\fR \fIheader\fR\fR
247 248 .ad
248 249 .RS 14n
249 250 Reads or writes header information in \fIheader\fR format. Always use this
250 251 option or the \fB-c\fR option when the origin and the destination machines are
251 252 different types. This option is mutually exclusive with options \fB-c\fR and
252 253 \fB-6\fR.
253 254 .sp
254 255 Valid values for \fIheader\fR are:
255 256 .sp
256 257 .ne 2
257 258 .na
258 259 \fB\fBbar\fR\fR
259 260 .ad
260 261 .RS 17n
261 262 \fBbar\fR head and format. Used only with the \fB-i\fR option ( read only).
262 263 .RE
263 264
264 265 .sp
265 266 .ne 2
266 267 .na
267 268 \fB\fBcrc\fR | \fBCRC\fR\fR
268 269 .ad
269 270 .RS 17n
270 271 \fBASCII\fR header with expanded device numbers and an additional per-file
271 272 checksum. There are no \fBUID\fR or \fBGID\fR restrictions associated with this
272 273 header format.
273 274 .RE
274 275
275 276 .sp
276 277 .ne 2
277 278 .na
278 279 \fB\fBodc\fR\fR
279 280 .ad
280 281 .RS 17n
281 282 \fBASCII\fR header with small device numbers. This is the IEEE/P1003 Data
282 283 Interchange Standard cpio header and format. It has the widest range of
283 284 portability of any of the header formats. It is the official format for
284 285 transferring files between POSIX-conforming systems (see \fBstandards\fR(5)).
285 286 Use this format to communicate with SunOS 4 and Interactive UNIX. This header
286 287 format allows \fBUID\fRs and \fBGID\fRs up to 262143 to be stored in the
287 288 header.
288 289 .RE
289 290
290 291 .sp
291 292 .ne 2
292 293 .na
293 294 \fB\fBtar\fR | \fBTAR\fR\fR
294 295 .ad
295 296 .RS 17n
296 297 \fBtar\fR header and format. This is an older \fBtar\fR header format that
297 298 allows \fBUID\fRs and \fBGID\fRs up to 2097151 to be stored in the header. It
298 299 is provided for the reading of legacy archives only, that is, in conjunction
299 300 with option \fB-i\fR.
300 301 .sp
301 302 Specifying this archive format with option \fB-o\fR has the same effect as
302 303 specifying the "ustar" format: the output archive is in \fBustar\fR format, and
303 304 must be read using \fB-H\fR \fBustar\fR.
304 305 .RE
305 306
306 307 .sp
307 308 .ne 2
308 309 .na
309 310 \fB\fBustar\fR | \fBUSTAR\fR\fR
310 311 .ad
311 312 .RS 17n
312 313 IEEE/P1003 Data Interchange Standard tar header and format. This header format
313 314 allows \fBUID\fRs and \fBGID\fRs up to 2097151 to be stored in the header.
314 315 .RE
315 316
316 317 Files with \fBUID\fRs and \fBGID\fRs greater than the limit stated above are
317 318 archived with the \fBUID\fR and \fBGID\fR of \fB60001\fR. To transfer a large
318 319 file (8 Gb \(em 1 byte), the header format can be \fBtar|TAR\fR,
319 320 \fBustar|USTAR\fR, or \fBodc\fR only.
320 321 .RE
321 322
322 323 .sp
323 324 .ne 2
324 325 .na
325 326 \fB\fB-I\fR \fIfile\fR\fR
326 327 .ad
327 328 .RS 14n
328 329 Reads the contents of \fIfile\fR as an input archive, instead of the standard
329 330 input. If \fIfile\fR is a character special device, and the current medium has
330 331 been completely read, replace the medium and press RETURN to continue to the
331 332 next medium. This option is used only with the \fB-i\fR option.
332 333 .RE
333 334
334 335 .sp
335 336 .ne 2
336 337 .na
337 338 \fB\fB-k\fR\fR
338 339 .ad
339 340 .RS 14n
340 341 Attempts to skip corrupted file headers and I/O errors that might be
341 342 encountered. If you want to copy files from a medium that is corrupted or out
342 343 of sequence, this option lets you read only those files with good headers. For
343 344 \fBcpio\fR archives that contain other \fBcpio\fR archives, if an error is
344 345 encountered, \fBcpio\fR can terminate prematurely. \fBcpio\fR finds the next
345 346 good header, which can be one for a smaller archive, and terminate when the
346 347 smaller archive's trailer is encountered. Use only with the \fB-i\fR option.
347 348 .RE
348 349
349 350 .sp
350 351 .ne 2
351 352 .na
352 353 \fB\fB-l\fR\fR
353 354 .ad
354 355 .RS 14n
355 356 In pass mode, makes hard links between the source and destination whenever
356 357 possible. If the \fB-L\fR option is also specified, the hard link is to the
357 358 file referred to by the symbolic link. Otherwise, the hard link is to the
358 359 symbolic link itself. Use only with the \fB-p\fR option.
359 360 .RE
360 361
361 362 .sp
362 363 .ne 2
363 364 .na
364 365 \fB\fB-L\fR\fR
365 366 .ad
366 367 .RS 14n
367 368 Follows symbolic links. If a symbolic link to a directory is encountered,
368 369 archives the directory referred to by the link, using the name of the link.
369 370 Otherwise, archives the file referred to by the link, using the name of the
370 371 link.
371 372 .RE
372 373
373 374 .sp
374 375 .ne 2
375 376 .na
376 377 \fB\fB-m\fR\fR
377 378 .ad
378 379 .RS 14n
379 380 Retains previous file modification time. This option is ineffective on
380 381 directories that are being copied.
381 382 .RE
382 383
383 384 .sp
384 385 .ne 2
385 386 .na
386 387 \fB\fB-M\fR \fImessage\fR\fR
387 388 .ad
388 389 .RS 14n
389 390 Defines a \fImessage\fR to use when switching media. When you use the \fB-O\fR
390 391 or \fB-I\fR options and specify a character special device, you can use this
391 392 option to define the message that is printed when you reach the end of the
392 393 medium. One \fB%d\fR can be placed in \fImessage\fR to print the sequence
393 394 number of the next medium needed to continue.
394 395 .RE
395 396
396 397 .sp
397 398 .ne 2
398 399 .na
399 400 \fB\fB-O\fR \fIfile\fR\fR
400 401 .ad
401 402 .RS 14n
402 403 Directs the output of \fBcpio\fR to \fIfile\fR, instead of the standard output.
403 404 If \fIfile\fR is a character special device and the current medium is full,
404 405 replace the medium and type a carriage return to continue to the next medium.
405 406 Use only with the \fB-o\fR option.
406 407 .RE
407 408
408 409 .sp
409 410 .ne 2
410 411 .na
411 412 \fB\fB-P\fR\fR
412 413 .ad
413 414 .RS 14n
414 415 Preserves \fBACL\fRs. If the option is used for output, existing \fBACL\fRs are
↓ open down ↓ |
373 lines elided |
↑ open up ↑ |
415 416 written along with other attributes, except for extended attributes, to the
416 417 standard output. \fBACL\fRs are created as special files with a special file
417 418 type. If the option is used for input, existing \fBACL\fRs are extracted along
418 419 with other attributes from standard input. The option recognizes the special
419 420 file type. Notice that errors occurs if a \fBcpio\fR archive with \fBACL\fRs is
420 421 extracted by previous versions of \fBcpio\fR. This option should not be used
421 422 with the \fB-c\fR option, as \fBACL\fR support might not be present on all
422 423 systems, and hence is not portable. Use \fBASCII\fR headers for portability.
423 424 .RE
424 425
426 +.sp
427 +.ne 2
428 +.na
429 +\fB\fB-q\fR\fR
430 +.ad
431 +.RS 14n
432 +Quiet. Suppresses the number of blocks message that normally is printed
433 +after the copy is completed.
434 +.RE
435 +
425 436 .sp
426 437 .ne 2
427 438 .na
428 439 \fB\fB-r\fR\fR
429 440 .ad
430 441 .RS 14n
431 442 Interactively renames files. If the user types a carriage return alone, the
432 443 file is skipped. If the user types a ``.'', the original pathname is retained.
433 444 Not available with \fBcpio\fR \fB-p\fR.
434 445 .RE
435 446
436 447 .sp
437 448 .ne 2
438 449 .na
439 450 \fB\fB-R\fR \fIid\fR\fR
440 451 .ad
441 452 .RS 14n
442 453 Reassigns ownership and group information for each file to user ID. (ID must be
443 454 a valid login ID from the \fBpasswd\fR database.) This option is valid only
444 455 when id is the invoking user or the super-user. See \fBNOTES\fR.
445 456 .RE
446 457
447 458 .sp
448 459 .ne 2
449 460 .na
450 461 \fB\fB-s\fR\fR
451 462 .ad
452 463 .RS 14n
453 464 Swaps bytes within each half word.
454 465 .RE
455 466
456 467 .sp
457 468 .ne 2
458 469 .na
459 470 \fB\fB-S\fR\fR
460 471 .ad
461 472 .RS 14n
462 473 Swaps halfwords within each word.
463 474 .RE
464 475
465 476 .sp
466 477 .ne 2
467 478 .na
468 479 \fB\fB-t\fR\fR
469 480 .ad
470 481 .RS 14n
471 482 Prints a table of contents of the input. If any file in the table of contents
472 483 has extended attributes, these are also listed. No files are created. \fB-t\fR
473 484 and \fB-V\fR are mutually exclusive.
474 485 .RE
475 486
476 487 .sp
477 488 .ne 2
478 489 .na
479 490 \fB\fB-u\fR\fR
480 491 .ad
481 492 .RS 14n
482 493 Copies unconditionally. Normally, an older file is not replaced a newer file
483 494 with the same name, although an older directory updates a newer directory.
484 495 .RE
485 496
486 497 .sp
487 498 .ne 2
488 499 .na
489 500 \fB\fB-v\fR\fR
490 501 .ad
491 502 .RS 14n
492 503 Verbose. Prints a list of file and extended attribute names. When used with the
493 504 \fB-t\fR option, the table of contents looks like the output of an \fBls\fR
494 505 \fB-l\fR command (see \fBls\fR(1)).
495 506 .RE
496 507
497 508 .sp
498 509 .ne 2
499 510 .na
500 511 \fB\fB-V\fR\fR
501 512 .ad
502 513 .RS 14n
503 514 Special verbose. Prints a dot for each file read or written. Useful to assure
504 515 the user that \fBcpio\fR is working without printing out all file names.
505 516 .RE
506 517
507 518 .sp
508 519 .ne 2
509 520 .na
510 521 \fB\fB-6\fR\fR
511 522 .ad
512 523 .RS 14n
513 524 Processes a UNIX System Sixth Edition archive format file. Use only with the
514 525 \fB-i\fR option. This option is mutually exclusive with \fB-c\fR and \fB-H\fR.
515 526 .RE
516 527
517 528 .sp
518 529 .ne 2
519 530 .na
520 531 \fB\fB-@\fR\fR
521 532 .ad
522 533 .RS 14n
523 534 Includes extended attributes in archive. By default, \fBcpio\fR does not place
524 535 extended attributes in the archive. With this flag, \fBcpio\fR looks for
525 536 extended attributes on the files to be placed in the archive and add them, as
526 537 regular files, to the archive. The extended attribute files go in the archive
527 538 as special files with special file types. When the \fB-@\fR flag is used with
528 539 \fB-i\fR or \fB-p\fR, it instructs \fBcpio\fR to restore extended attribute
529 540 data along with the normal file data. Extended attribute files can only be
530 541 extracted from an archive as part of a normal file extract. Attempts to
531 542 explicitly extract attribute records are ignored.
532 543 .RE
533 544
534 545 .sp
535 546 .ne 2
536 547 .na
537 548 \fB\fB-/\fR\fR
538 549 .ad
539 550 .RS 14n
540 551 Includes extended system attributes in archive. By default, \fBcpio\fR does not
541 552 place extended system attributes in the archive. With this flag, \fBcpio\fR
542 553 looks for extended system attributes on the files to be placed in the archive
543 554 and add them, as regular files, to the archive. The extended attribute files go
544 555 in the archive as special files with special file types. When the \fB-/\fR flag
545 556 is used with \fB-i\fR or \fB-p\fR, it instructs \fBcpio\fR to restore extended
546 557 system attribute data along with the normal file data. Extended system
547 558 attribute files can only be extracted from an archive as part of a normal file
548 559 extract. Attempts to explicitly extract attribute records are ignored.
549 560 .RE
550 561
551 562 .SH OPERANDS
552 563 .sp
553 564 .LP
554 565 The following operands are supported:
555 566 .sp
556 567 .ne 2
557 568 .na
558 569 \fB\fIdirectory\fR\fR
559 570 .ad
560 571 .RS 13n
561 572 A path name of an existing directory to be used as the target of \fBcpio\fR
562 573 \fB-p\fR.
563 574 .RE
564 575
565 576 .sp
566 577 .ne 2
567 578 .na
568 579 \fB\fIpattern\fR\fR
569 580 .ad
570 581 .RS 13n
571 582 Expressions making use of a pattern-matching notation similar to that used by
572 583 the shell (see \fBsh\fR(1)) for filename pattern matching, and similar to
573 584 regular expressions. The following metacharacters are defined:
574 585 .sp
575 586 .ne 2
576 587 .na
577 588 \fB\fB*\fR\fR
578 589 .ad
579 590 .RS 9n
580 591 Matches any string, including the empty string.
581 592 .RE
582 593
583 594 .sp
584 595 .ne 2
585 596 .na
586 597 \fB\fB?\fR\fR
587 598 .ad
588 599 .RS 9n
589 600 Matches any single character.
590 601 .RE
591 602
592 603 .sp
593 604 .ne 2
594 605 .na
595 606 \fB\fB[...]\fR\fR
596 607 .ad
597 608 .RS 9n
598 609 Matches any one of the enclosed characters. A pair of characters separated by
599 610 `\(mi' matches any symbol between the pair (inclusive), as defined by the
600 611 system default collating sequence. If the first character following the opening
601 612 \fB`['\fR is a \fB`!'\fR, the results are unspecified.
602 613 .RE
603 614
604 615 .sp
605 616 .ne 2
606 617 .na
607 618 \fB\fB!\fR\fR
608 619 .ad
609 620 .RS 9n
610 621 The ! (exclamation point) means \fInot\fR. For example, the \fB!abc*\fR pattern
611 622 would exclude all files that begin with \fBabc\fR.
612 623 .RE
613 624
614 625 In \fIpattern\fR, metacharacters \fB?\fR, \fB*\fR, and \fB[\fR\|.\|.\|.\fB]\fR
615 626 match the slash (\fB/\fR) character, and backslash (\fB\e\fR) is an escape
616 627 character. Multiple cases of \fIpattern\fR can be specified and if no
617 628 \fIpattern\fR is specified, the default for \fIpattern\fR is \fB*\fR (that is,
618 629 select all files).
619 630 .sp
620 631 Each pattern must be enclosed in double quotes. Otherwise, the name of a file
621 632 in the current directory might be used.
622 633 .RE
623 634
624 635 .SH USAGE
625 636 .sp
626 637 .LP
627 638 See \fBlargefile\fR(5) for the description of the behavior of \fBcpio\fR when
628 639 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
629 640 .SH EXAMPLES
630 641 .sp
631 642 .LP
632 643 The following examples show three uses of \fBcpio\fR.
633 644 .LP
634 645 \fBExample 1 \fRUsing standard input
635 646 .sp
636 647 .in +2
637 648 .nf
638 649 example% \fBls | cpio -oc > ../newfile\fR
639 650 .fi
640 651 .in -2
641 652 .sp
642 653
643 654 .sp
644 655 .LP
645 656 When standard input is directed through a pipe to \fBcpio\fR \fB-o\fR, as in
646 657 the example above, it groups the files so they can be directed (>) to a single
647 658 file (\fB\&../newfile\fR). The \fB-c\fR option insures that the file is
648 659 portable to other machines (as would the \fB-H\fR option). Instead of
649 660 \fBls\fR(1), you could use \fBfind\fR(1), \fBecho\fR(1), \fBcat\fR(1), and so
650 661 on, to pipe a list of names to \fBcpio\fR. You could direct the output to a
651 662 device instead of a file.
652 663
653 664 .LP
654 665 \fBExample 2 \fRExtracting files into directories
655 666 .sp
656 667 .in +2
657 668 .nf
658 669 example% \fBcat newfile | cpio -icd "memo/a1" "memo/b*"\fR
659 670 .fi
660 671 .in -2
661 672 .sp
662 673
663 674 .sp
664 675 .LP
665 676 In this example, \fBcpio\fR \fB-i\fR uses the output file of \fBcpio\fR
666 677 \fB-o\fR (directed through a pipe with \fBcat\fR), extracts those files that
667 678 match the patterns (\fBmemo/a1\fR, \fBmemo/b*\fR), creates directories below
668 679 the current directory as needed (\fB-d\fR option), and places the files in the
669 680 appropriate directories. The \fB-c\fR option is used if the input file was
670 681 created with a portable header. If no patterns were given, all files from
671 682 \fBnewfile\fR would be placed in the directory.
672 683
673 684 .LP
674 685 \fBExample 3 \fRCopying or linking files to another directory
675 686 .sp
676 687 .in +2
677 688 .nf
678 689 example% \fBfind . -depth -print | cpio -pdlmv newdir\fR
679 690 .fi
680 691 .in -2
681 692 .sp
682 693
683 694 .sp
684 695 .LP
685 696 In this example, \fBcpio\fR \fB-p\fR takes the file names piped to it and
686 697 copies or links (\fB-l\fR option) those files to another directory,
687 698 \fBnewdir\fR. The \fB-d\fR option says to create directories as needed. The
688 699 \fB-m\fR option says to retain the modification time. (It is important to use
689 700 the \fB-depth\fR option of \fBfind\fR(1) to generate path names for \fBcpio\fR.
690 701 This eliminates problems that \fBcpio\fR could have trying to create files
691 702 under read-only directories.) The destination directory, \fBnewdir\fR, must
692 703 exist.
693 704
694 705 .sp
695 706 .LP
696 707 Notice that when you use \fBcpio\fR in conjunction with \fBfind\fR, if you use
697 708 the \fB-L\fR option with \fBcpio\fR, you must use the \fB-follow\fR option with
698 709 \fBfind\fR and vice versa. Otherwise, there are undesirable results.
699 710 .sp
700 711 .LP
701 712 For multi-reel archives, dismount the old volume, mount the new one, and
702 713 continue to the next tape by typing the name of the next device (probably the
703 714 same as the first reel). To stop, type a RETURN and \fBcpio\fR ends.
704 715 .SH ENVIRONMENT VARIABLES
705 716 .sp
706 717 .LP
707 718 See \fBenviron\fR(5) for descriptions of the following environment variables
708 719 that affect the execution of \fBcpio\fR: \fBLC_COLLATE\fR, \fBLC_CTYPE\fR,
709 720 \fBLC_MESSAGES\fR, \fBLC_TIME\fR, \fBTZ\fR, and \fBNLSPATH\fR.
710 721 .sp
711 722 .ne 2
712 723 .na
713 724 \fB\fBTMPDIR\fR\fR
714 725 .ad
715 726 .RS 10n
716 727 \fBcpio\fR creates its temporary file in \fB/var/tmp\fR by default. Otherwise,
717 728 it uses the directory specified by \fBTMPDIR\fR.
718 729 .RE
719 730
720 731 .SH EXIT STATUS
721 732 .sp
722 733 .LP
723 734 The following exit values are returned:
724 735 .sp
725 736 .ne 2
726 737 .na
727 738 \fB\fB0\fR\fR
728 739 .ad
729 740 .RS 6n
730 741 Successful completion.
731 742 .RE
732 743
733 744 .sp
734 745 .ne 2
735 746 .na
736 747 \fB\fB>0\fR\fR
737 748 .ad
738 749 .RS 6n
739 750 An error occurred.
740 751 .RE
741 752
742 753 .SH ATTRIBUTES
743 754 .sp
744 755 .LP
745 756 See \fBattributes\fR(5) for descriptions of the following attributes:
746 757 .sp
747 758
748 759 .sp
749 760 .TS
750 761 box;
751 762 c | c
752 763 l | l .
753 764 ATTRIBUTE TYPE ATTRIBUTE VALUE
754 765 _
755 766 CSI Enabled
756 767 _
757 768 Interface Stability Committed
758 769 .TE
759 770
760 771 .SH SEE ALSO
761 772 .sp
762 773 .LP
763 774 \fBar\fR(1), \fBcat\fR(1), \fBecho\fR(1), \fBfind\fR(1), \fBls\fR(1),
764 775 \fBpax\fR(1), \fBsetfacl\fR(1), \fBsh\fR(1), \fBtar\fR(1), \fBchown\fR(2),
765 776 \fBarchives.h\fR(3HEAD), \fBattributes\fR(5), \fBenviron\fR(5),
766 777 \fBfsattr\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
767 778 .SH NOTES
768 779 .sp
769 780 .LP
770 781 The maximum path name length allowed in a \fBcpio\fR archive is determined by
771 782 the header type involved. The following table shows the proper value for each
772 783 supported archive header type.
773 784 .sp
774 785
775 786 .sp
776 787 .TS
777 788 c c c
778 789 l l l .
779 790 Header type Command line options Maximum path name length
780 791 BINARY "\fB-o\fR" 256
781 792 POSIX "\fB-oH\fR odc" 256
782 793 ASCII "\fB-oc\fR" 1023
783 794 CRC "\fB-oH\fR crc" 1023
784 795 USTAR "\fB-oH\fR ustar" 255
785 796 .TE
786 797
787 798 .sp
788 799 .LP
789 800 When the command line options "\fB-o\fR \fB-H\fR \fBtar\fR" are specified, the
790 801 archive created is of type \fBUSTAR\fR. This means that it is an error to read
791 802 this same archive using the command line options "\fB-i\fR \fB-H\fR \fBtar\fR".
792 803 The archive should be read using the command line options "\fB-i\fR \fB-H\fR
793 804 \fBustar\fR". The options "\fB-i\fR \fB-H\fR \fBtar\fR" refer to an older tar
794 805 archive format.
795 806 .sp
796 807 .LP
797 808 An error message is output for files whose \fBUID\fR or \fBGID\fR are too large
798 809 to fit in the selected header format. Use \fB-H\fR \fBcrc\fR or \fB-c\fR to
799 810 create archives that allow all \fBUID\fR or \fBGID\fR values.
800 811 .sp
801 812 .LP
802 813 Only the super-user can copy special files.
803 814 .sp
804 815 .LP
805 816 Blocks are reported in 512-byte quantities.
806 817 .sp
807 818 .LP
808 819 If a file has \fB000\fR permissions, contains more than 0 characters of data,
809 820 and the user is not root, the file is not saved or restored.
810 821 .sp
811 822 .LP
812 823 When cpio is invoked in \fBCopy In\fR or \fBPass Mode\fR by a user with
813 824 \fB{PRIV_FILE_CHOWN_SELF}\fR privilege, and in particular on a system where
814 825 \fB{_POSIX_CHOWN_RESTRICTED}\fR is not in effect (effectively granting this
815 826 privilege to all users where not overridden), extracted or copied files can end
816 827 up with owners and groups determined by those of the original archived files,
817 828 which can differ from the invoking user's. This might not be what the user
818 829 intended. The \fB-R\fR option can be used to retain file ownership, if desired,
819 830 if you specify the user's id.
820 831 .sp
821 832 .LP
822 833 The inode number stored in the header (\fB/usr/include/archives.h\fR) is an
823 834 unsigned short, which is 2 bytes. This limits the range of inode numbers from
824 835 \fB0\fR to \fB65535\fR. Files which are hard linked must fall in this inode
825 836 range. This could be a problem when moving \fBcpio\fR archives between
826 837 different vendors' machines.
827 838 .sp
828 839 .LP
829 840 You must use the same blocking factor when you retrieve or copy files from the
830 841 tape to the hard disk as you did when you copied files from the hard disk to
831 842 the tape. Therefore, you must specify the \fB-B\fR or \fB-C\fR option.
832 843 .sp
833 844 .LP
834 845 During \fB-p\fR and \fB-o\fR processing, \fBcpio\fR buffers the file list
835 846 presented on stdin in a temporary file.
836 847 .sp
837 848 .LP
838 849 The new \fBpax\fR(1) format, with a command that supports it (for example,
839 850 \fBtar\fR), should be used for large files. The \fBcpio\fR command is no longer
840 851 part of the current POSIX standard and is deprecated in favor of \fBpax\fR.
↓ open down ↓ |
406 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX