1 <!-- Creator : groff version 1.22.3 -->
2 <!-- CreationDate: Tue Feb 11 22:58:47 2020 -->
3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
4 "http://www.w3.org/TR/html4/loose.dtd">
7 <meta name="generator" content="groff -Thtml, see www.gnu.org">
8 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
9 <meta name="Content-Style" content="text/css">
10 <style type="text/css">
11 p { margin-top: 0; margin-bottom: 0; vertical-align: top }
12 pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
13 table { margin-top: 0; margin-bottom: 0; vertical-align: top }
14 h1 { text-align: center }
23 <p>CPIO(1) BSD General Commands Manual CPIO(1)</p>
25 <p style="margin-top: 1em"><b>NAME</b></p>
27 <p style="margin-left:6%;"><b>cpio</b> — copy files
28 to and from archives</p>
30 <p style="margin-top: 1em"><b>SYNOPSIS</b></p>
32 <p style="margin-left:13%;"><b>cpio -i</b> [<i>options</i>]
33 [<i>pattern ...</i>] [<i>< archive</i>] <b><br>
34 cpio -o</b> [<i>options</i>] <i>< name-list</i>
35 [<i>> archive</i>] <b><br>
36 cpio -p</b> [<i>options</i>] <i>dest-dir <
39 <p style="margin-top: 1em"><b>DESCRIPTION</b></p>
41 <p style="margin-left:6%;"><b>cpio</b> copies files between
42 archives and directories. This implementation can extract
43 from tar, pax, cpio, zip, jar, ar, and ISO 9660 cdrom images
44 and can create tar, pax, cpio, ar, and shar archives.</p>
46 <p style="margin-left:6%; margin-top: 1em">The first option
47 to <b>cpio</b> is a mode indicator from the following
52 <p style="margin-left:17%; margin-top: 1em">Input. Read an
53 archive from standard input (unless overridden) and extract
54 the contents to disk or (if the <b>-t</b> option is
55 specified) list the contents to standard output. If one or
56 more file patterns are specified, only files matching one of
57 the patterns will be extracted.</p>
61 <p style="margin-left:17%; margin-top: 1em">Output. Read a
62 list of filenames from standard input and produce a new
63 archive on standard output (unless overridden) containing
64 the specified items.</p>
68 <p style="margin-left:17%; margin-top: 1em">Pass-through.
69 Read a list of filenames from standard input and copy the
70 files to the specified directory.</p>
72 <p style="margin-top: 1em"><b>OPTIONS</b></p>
74 <p style="margin-left:6%;">Unless specifically stated
75 otherwise, options are applicable in all operating
78 <p style="margin-top: 1em"><b>-0</b>, <b>--null</b></p>
80 <p style="margin-left:17%;">Read filenames separated by NUL
81 characters instead of newlines. This is necessary if any of
82 the filenames being read might contain newlines.</p>
84 <p style="margin-top: 1em"><b>-A</b></p>
86 <p style="margin-left:17%; margin-top: 1em">(o mode only)
87 Append to the specified archive. (Not yet implemented.)</p>
89 <p style="margin-top: 1em"><b>-a</b></p>
91 <p style="margin-left:17%; margin-top: 1em">(o and p modes)
92 Reset access times on files after they are read.</p>
94 <p style="margin-top: 1em"><b>-B</b></p>
96 <p style="margin-left:17%; margin-top: 1em">(o mode only)
97 Block output to records of 5120 bytes.</p>
99 <p style="margin-top: 1em"><b>-C</b> <i>size</i></p>
101 <p style="margin-left:17%;">(o mode only) Block output to
102 records of <i>size</i> bytes.</p>
104 <p style="margin-top: 1em"><b>-c</b></p>
106 <p style="margin-left:17%; margin-top: 1em">(o mode only)
107 Use the old POSIX portable character format. Equivalent to
108 <b>--format</b> <i>odc</i>.</p>
110 <p style="margin-top: 1em"><b>-d</b>,
111 <b>--make-directories</b></p>
113 <p style="margin-left:17%;">(i and p modes) Create
114 directories as necessary.</p>
116 <p style="margin-top: 1em"><b>-E</b> <i>file</i></p>
118 <p style="margin-left:17%;">(i mode only) Read list of file
119 name patterns from <i>file</i> to list and extract.</p>
121 <p style="margin-top: 1em"><b>-F</b> <i>file</i>,
122 <b>--file</b> <i>file</i></p>
124 <p style="margin-left:17%;">Read archive from or write
125 archive to <i>file</i>.</p>
127 <p style="margin-top: 1em"><b>-f</b> <i>pattern</i></p>
129 <p style="margin-left:17%;">(i mode only) Ignore files that
130 match <i>pattern</i>.</p>
132 <p style="margin-top: 1em"><b>-H</b> <i>format</i>,
133 <b>--format</b> <i>format</i></p>
135 <p style="margin-left:17%;">(o mode only) Produce the
136 output archive in the specified format. Supported formats
139 <p style="margin-top: 1em"><i>cpio</i></p>
141 <p style="margin-left:28%; margin-top: 1em">Synonym for
146 <p style="margin-left:28%; margin-top: 1em">The SVR4
147 portable cpio format.</p>
151 <p style="margin-left:28%; margin-top: 1em">The old POSIX.1
152 portable octet-oriented cpio format.</p>
156 <p style="margin-left:28%; margin-top: 1em">The POSIX.1 pax
157 format, an extension of the ustar format.</p>
161 <p style="margin-left:28%; margin-top: 1em">The POSIX.1 tar
164 <p style="margin-left:17%; margin-top: 1em">The default
165 format is <i>odc</i>. See libarchive-formats(5) for more
166 complete information about the formats currently supported
167 by the underlying libarchive(3) library.</p>
169 <p style="margin-top: 1em"><b>-h</b>, <b>--help</b></p>
171 <p style="margin-left:17%;">Print usage information.</p>
173 <p style="margin-top: 1em"><b>-I</b> <i>file</i></p>
175 <p style="margin-left:17%;">Read archive from
178 <p style="margin-top: 1em"><b>-i</b>, <b>--extract</b></p>
180 <p style="margin-left:17%;">Input mode. See above for
183 <p style="margin-top: 1em"><b>--insecure</b></p>
185 <p style="margin-left:17%;">(i and p mode only) Disable
186 security checks during extraction or copying. This allows
187 extraction via symbolic links, absolute paths, and path
188 names containing ’..’ in the name.</p>
190 <p style="margin-top: 1em"><b>-J</b>, <b>--xz</b></p>
192 <p style="margin-left:17%;">(o mode only) Compress the file
193 with xz-compatible compression before writing it. In input
194 mode, this option is ignored; xz compression is recognized
195 automatically on input.</p>
197 <p style="margin-top: 1em"><b>-j</b></p>
199 <p style="margin-left:17%; margin-top: 1em">Synonym for
202 <p style="margin-top: 1em"><b>-L</b></p>
204 <p style="margin-left:17%; margin-top: 1em">(o and p modes)
205 All symbolic links will be followed. Normally, symbolic
206 links are archived and copied as symbolic links. With this
207 option, the target of the link will be archived or copied
210 <p style="margin-top: 1em"><b>-l</b>, <b>--link</b></p>
212 <p style="margin-left:17%;">(p mode only) Create links from
213 the target directory to the original files, instead of
216 <p style="margin-top: 1em"><b>--lrzip</b></p>
218 <p style="margin-left:17%;">(o mode only) Compress the
219 resulting archive with lrzip(1). In input mode, this option
222 <p style="margin-top: 1em"><b>--lz4</b></p>
224 <p style="margin-left:17%; margin-top: 1em">(o mode only)
225 Compress the archive with lz4-compatible compression before
226 writing it. In input mode, this option is ignored; lz4
227 compression is recognized automatically on input.</p>
229 <p style="margin-top: 1em"><b>--zstd</b></p>
231 <p style="margin-left:17%; margin-top: 1em">(o mode only)
232 Compress the archive with zstd-compatible compression before
233 writing it. In input mode, this option is ignored; zstd
234 compression is recognized automatically on input.</p>
236 <p style="margin-top: 1em"><b>--lzma</b></p>
238 <p style="margin-left:17%; margin-top: 1em">(o mode only)
239 Compress the file with lzma-compatible compression before
240 writing it. In input mode, this option is ignored; lzma
241 compression is recognized automatically on input.</p>
243 <p style="margin-top: 1em"><b>--lzop</b></p>
245 <p style="margin-left:17%; margin-top: 1em">(o mode only)
246 Compress the resulting archive with lzop(1). In input mode,
247 this option is ignored.</p>
249 <p style="margin-top: 1em"><b>--passphrase</b>
250 <i>passphrase</i></p>
252 <p style="margin-left:17%;">The <i>passphrase</i> is used
253 to extract or create an encrypted archive. Currently, zip is
254 only a format that <b>cpio</b> can handle encrypted
255 archives. You shouldn’t use this option unless you
256 realize how insecure use of this option is.</p>
258 <p style="margin-top: 1em"><b>-m</b>,
259 <b>--preserve-modification-time</b></p>
261 <p style="margin-left:17%;">(i and p modes) Set file
262 modification time on created files to match those in the
265 <p style="margin-top: 1em"><b>-n</b>,
266 <b>--numeric-uid-gid</b></p>
268 <p style="margin-left:17%;">(i mode, only with <b>-t</b>)
269 Display numeric uid and gid. By default, <b>cpio</b>
270 displays the user and group names when they are provided in
271 the archive, or looks up the user and group names in the
272 system password database.</p>
274 <p style="margin-top: 1em"><b>--no-preserve-owner</b></p>
276 <p style="margin-left:17%;">(i mode only) Do not attempt to
277 restore file ownership. This is the default when run by
280 <p style="margin-top: 1em"><b>-O</b> <i>file</i></p>
282 <p style="margin-left:17%;">Write archive to
285 <p style="margin-top: 1em"><b>-o</b>, <b>--create</b></p>
287 <p style="margin-left:17%;">Output mode. See above for
290 <p style="margin-top: 1em"><b>-p</b>,
291 <b>--pass-through</b></p>
293 <p style="margin-left:17%;">Pass-through mode. See above
296 <p style="margin-top: 1em"><b>--preserve-owner</b></p>
298 <p style="margin-left:17%;">(i mode only) Restore file
299 ownership. This is the default when run by the root
302 <p style="margin-top: 1em"><b>--quiet</b></p>
304 <p style="margin-left:17%;">Suppress unnecessary
307 <p style="margin-top: 1em"><b>-R</b> [ <br>
310 group], <b>--owner</b> [ <br>
315 <p style="margin-left:17%;">Set the owner and/or group on
316 files in the output. If group is specified with no user (for
317 example, <b>-R</b> <i>:wheel</i>) then the group will be set
318 but not the user. If the user is specified with a trailing
319 colon and no group (for example, <b>-R</b> <i>root:</i>)
320 then the group will be set to the user’s default
321 group. If the user is specified with no trailing colon, then
322 the user will be set but not the group. In <b>-i</b> and
323 <b>-p</b> modes, this option can only be used by the
324 super-user. (For compatibility, a period can be used in
325 place of the colon.)</p>
327 <p style="margin-top: 1em"><b>-r</b></p>
329 <p style="margin-left:17%; margin-top: 1em">(All modes.)
330 Rename files interactively. For each file, a prompt is
331 written to <i>/dev/tty</i> containing the name of the file
332 and a line is read from <i>/dev/tty</i>. If the line read is
333 blank, the file is skipped. If the line contains a single
334 period, the file is processed normally. Otherwise, the line
335 is taken to be the new name of the file.</p>
337 <p style="margin-top: 1em"><b>-t</b>, <b>--list</b></p>
339 <p style="margin-left:17%;">(i mode only) List the contents
340 of the archive to stdout; do not restore the contents to
343 <p style="margin-top: 1em"><b>-u</b>,
344 <b>--unconditional</b></p>
346 <p style="margin-left:17%;">(i and p modes) Unconditionally
347 overwrite existing files. Ordinarily, an older file will not
348 overwrite a newer file on disk.</p>
350 <p style="margin-top: 1em"><b>-V</b>, <b>--dot</b></p>
352 <p style="margin-left:17%;">Print a dot to stderr for each
353 file as it is processed. Superseded by <b>-v</b>.</p>
355 <p style="margin-top: 1em"><b>-v</b>, <b>--verbose</b></p>
357 <p style="margin-left:17%;">Print the name of each file to
358 stderr as it is processed. With <b>-t</b>, provide a
359 detailed listing of each file.</p>
361 <p style="margin-top: 1em"><b>--version</b></p>
363 <p style="margin-left:17%;">Print the program version
364 information and exit.</p>
366 <p style="margin-top: 1em"><b>-y</b></p>
368 <p style="margin-left:17%; margin-top: 1em">(o mode only)
369 Compress the archive with bzip2-compatible compression
370 before writing it. In input mode, this option is ignored;
371 bzip2 compression is recognized automatically on input.</p>
373 <p style="margin-top: 1em"><b>-Z</b></p>
375 <p style="margin-left:17%; margin-top: 1em">(o mode only)
376 Compress the archive with compress-compatible compression
377 before writing it. In input mode, this option is ignored;
378 compression is recognized automatically on input.</p>
380 <p style="margin-top: 1em"><b>-z</b></p>
382 <p style="margin-left:17%; margin-top: 1em">(o mode only)
383 Compress the archive with gzip-compatible compression before
384 writing it. In input mode, this option is ignored; gzip
385 compression is recognized automatically on input.</p>
387 <p style="margin-top: 1em"><b>EXIT STATUS</b></p>
389 <p style="margin-left:6%;">The <b>cpio</b> utility
390 exits 0 on success, and >0 if an error
393 <p style="margin-top: 1em"><b>ENVIRONMENT</b></p>
395 <p style="margin-left:6%;">The following environment
396 variables affect the execution of <b>cpio</b>:</p>
398 <p style="margin-top: 1em">LANG</p>
400 <p style="margin-left:21%; margin-top: 1em">The locale to
401 use. See environ(7) for more information.</p>
403 <p style="margin-top: 1em">TZ</p>
405 <p style="margin-left:21%; margin-top: 1em">The timezone to
406 use when displaying dates. See environ(7) for more
409 <p style="margin-top: 1em"><b>EXAMPLES</b></p>
411 <p style="margin-left:6%;">The <b>cpio</b> command is
412 traditionally used to copy file hierarchies in conjunction
413 with the find(1) command. The first example here simply
414 copies all files from <i>src</i> to <i>dest</i>:</p>
416 <p style="margin-left:14%;"><b>find</b> <i>src</i> |
417 <b>cpio -pmud</b> <i>dest</i></p>
419 <p style="margin-left:6%; margin-top: 1em">By carefully
420 selecting options to the find(1) command and combining it
421 with other standard utilities, it is possible to exercise
422 very fine control over which files are copied. This next
423 example copies files from <i>src</i> to <i>dest</i> that are
424 more than 2 days old and whose names match a particular
427 <p style="margin-left:14%;"><b>find</b> <i>src</i>
428 <b>-mtime</b> <i>+2</i> | <b>grep foo[bar]</b> | <b>cpio
429 -pdmu</b> <i>dest</i></p>
431 <p style="margin-left:6%; margin-top: 1em">This example
432 copies files from <i>src</i> to <i>dest</i> that are more
433 than 2 days old and which contain the word
436 <p>foobar ’’:</p>
438 <p style="margin-left:14%;"><b>find</b> <i>src</i>
439 <b>-mtime</b> <i>+2</i> | <b>xargs grep -l foobar</b> |
440 <b>cpio -pdmu</b> <i>dest</i></p>
442 <p style="margin-top: 1em"><b>COMPATIBILITY</b></p>
444 <p style="margin-left:6%;">The mode options i, o, and p and
445 the options a, B, c, d, f, l, m, r, t, u, and v comply with
448 <p style="margin-left:6%; margin-top: 1em">The old POSIX.1
449 standard specified that only <b>-i</b>, <b>-o</b>, and
450 <b>-p</b> were interpreted as command-line options. Each
451 took a single argument of a list of modifier characters. For
452 example, the standard syntax allows <b>-imu</b> but does not
453 support <b>-miu</b> or <b>-i -m -u</b>, since <i>m</i> and
454 <i>u</i> are only modifiers to <b>-i</b>, they are not
455 command-line options in their own right. The syntax
456 supported by this implementation is backwards-compatible
457 with the standard. For best compatibility, scripts should
458 limit themselves to the standard syntax.</p>
460 <p style="margin-top: 1em"><b>SEE ALSO</b></p>
462 <p style="margin-left:6%;">bzip2(1), gzip(1), mt(1),
463 pax(1), tar(1), libarchive(3), cpio(5),
464 libarchive-formats(5), tar(5)</p>
466 <p style="margin-top: 1em"><b>STANDARDS</b></p>
468 <p style="margin-left:6%;">There is no current POSIX
469 standard for the cpio command; it appeared in ISO/IEC
470 9945-1:1996 (’’POSIX.1’’) but was
471 dropped from IEEE Std 1003.1-2001
472 (’’POSIX.1’’).</p>
474 <p style="margin-left:6%; margin-top: 1em">The cpio, ustar,
475 and pax interchange file formats are defined by IEEE Std
476 1003.1-2001 (’’POSIX.1’’) for the
479 <p style="margin-top: 1em"><b>HISTORY</b></p>
481 <p style="margin-left:6%;">The original <b>cpio</b> and
482 <b>find</b> utilities were written by Dick Haight while
483 working in AT&T’s Unix Support Group. They first
484 appeared in 1977 in PWB/UNIX 1.0, the
485 ’’Programmer’s Work Bench’’
486 system developed for use within AT&T. They were first
487 released outside of AT&T as part of System III Unix in
488 1981. As a result, <b>cpio</b> actually predates <b>tar</b>,
489 even though it was not well-known outside of AT&T until
492 <p style="margin-left:6%; margin-top: 1em">This is a
493 complete re-implementation based on the libarchive(3)
496 <p style="margin-top: 1em"><b>BUGS</b></p>
498 <p style="margin-left:6%;">The cpio archive format has
499 several basic limitations: It does not store user and group
500 names, only numbers. As a result, it cannot be reliably used
501 to transfer files between systems with dissimilar user and
502 group numbering. Older cpio formats limit the user and group
503 numbers to 16 or 18 bits, which is insufficient for modern
504 systems. The cpio archive formats cannot support files over
505 4 gigabytes, except for the ’’odc’’
506 variant, which can support files up to 8 gigabytes.</p>
508 <p style="margin-left:6%; margin-top: 1em">BSD
509 September 16, 2014 BSD</p>