1 .TH CPIO 1 "September 16, 2014" ""
5 \- copy files to and from archives
29 copies files between archives and directories.
30 This implementation can extract from tar, pax, cpio, zip, jar, ar,
31 and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
36 is a mode indicator from the following list:
41 Read an archive from standard input (unless overridden) and extract the
42 contents to disk or (if the
45 list the contents to standard output.
46 If one or more file patterns are specified, only files matching
47 one of the patterns will be extracted.
51 Read a list of filenames from standard input and produce a new archive
52 on standard output (unless overridden) containing the specified items.
56 Read a list of filenames from standard input and copy the files to the
61 Unless specifically stated otherwise, options are applicable in
65 \fB\-0\fP, \fB\-Fl\fP null
66 Read filenames separated by NUL characters instead of newlines.
67 This is necessary if any of the filenames being read might contain newlines.
71 Append to the specified archive.
72 (Not yet implemented.)
76 Reset access times on files after they are read.
80 Block output to records of 5120 bytes.
84 Block output to records of
90 Use the old POSIX portable character format.
92 \fB\-Fl\fP format \fIodc\fP.
94 \fB\-d\fP, \fB\-Fl\fP make-directories
96 Create directories as necessary.
100 Read list of file name patterns from
104 \fB\-F\fP \fIfile\fP, \fB\-Fl\fP file \fIfile\fP
105 Read archive from or write archive to
108 \fB\-f\fP \fIpattern\fP
110 Ignore files that match
113 \fB\-H\fP \fIformat\fP, \fB\-Fl\fP format \fIformat\fP
115 Produce the output archive in the specified format.
116 Supported formats include:
125 The SVR4 portable cpio format.
128 The old POSIX.1 portable octet-oriented cpio format.
131 The POSIX.1 pax format, an extension of the ustar format.
134 The POSIX.1 tar format.
137 The default format is
140 \fBlibarchive-formats\fP(5)
141 for more complete information about the
142 formats currently supported by the underlying
146 \fB\-h\fP, \fB\-Fl\fP help
147 Print usage information.
153 \fB\-i\fP, \fB\-Fl\fP extract
155 See above for description.
159 Disable security checks during extraction or copying.
160 This allows extraction via symbolic links, absolute paths,
161 and path names containing
165 \fB\-J\fP, \fB\-Fl\fP xz
167 Compress the file with xz-compatible compression before writing it.
168 In input mode, this option is ignored; xz compression is recognized
169 automatically on input.
177 All symbolic links will be followed.
178 Normally, symbolic links are archived and copied as symbolic links.
179 With this option, the target of the link will be archived or copied instead.
181 \fB\-l\fP, \fB\-Fl\fP link
183 Create links from the target directory to the original files,
188 Compress the resulting archive with
190 In input mode, this option is ignored.
194 Compress the archive with lz4-compatible compression before writing it.
195 In input mode, this option is ignored; lz4 compression is recognized
196 automatically on input.
200 Compress the archive with zstd-compatible compression before writing it.
201 In input mode, this option is ignored; zstd compression is recognized
202 automatically on input.
206 Compress the file with lzma-compatible compression before writing it.
207 In input mode, this option is ignored; lzma compression is recognized
208 automatically on input.
212 Compress the resulting archive with
214 In input mode, this option is ignored.
216 \fB\-Fl\fP passphrase \fIpassphrase\fP
219 is used to extract or create an encrypted archive.
220 Currently, zip is only a format that
222 can handle encrypted archives.
223 You shouldn't use this option unless you realize how insecure
224 use of this option is.
226 \fB\-m\fP, \fB\-Fl\fP preserve-modification-time
228 Set file modification time on created files to match
231 \fB\-n\fP, \fB\-Fl\fP numeric-uid-gid
234 Display numeric uid and gid.
237 displays the user and group names when they are provided in the
238 archive, or looks up the user and group names in the system
241 \fB\-Fl\fP no-preserve-owner
243 Do not attempt to restore file ownership.
244 This is the default when run by non-root users.
250 \fB\-o\fP, \fB\-Fl\fP create
252 See above for description.
254 \fB\-p\fP, \fB\-Fl\fP pass-through
256 See above for description.
258 \fB\-Fl\fP preserve-owner
260 Restore file ownership.
261 This is the default when run by the root user.
264 Suppress unnecessary messages.
266 \fB\-R\fP [user] [:] [group], \fB\-Fl\fP owner [user] [:] [group]
267 Set the owner and/or group on files in the output.
268 If group is specified with no user
270 \fB\-R\fP \fI:wheel\fP)
271 then the group will be set but not the user.
272 If the user is specified with a trailing colon and no group
274 \fB\-R\fP \fIroot:\fP)
275 then the group will be set to the user's default group.
276 If the user is specified with no trailing colon, then
277 the user will be set but not the group.
282 modes, this option can only be used by the super-user.
283 (For compatibility, a period can be used in place of the colon.)
287 Rename files interactively.
288 For each file, a prompt is written to
290 containing the name of the file and a line is read from
292 If the line read is blank, the file is skipped.
293 If the line contains a single period, the file is processed normally.
294 Otherwise, the line is taken to be the new name of the file.
296 \fB\-t\fP, \fB\-Fl\fP list
298 List the contents of the archive to stdout;
299 do not restore the contents to disk.
301 \fB\-u\fP, \fB\-Fl\fP unconditional
303 Unconditionally overwrite existing files.
304 Ordinarily, an older file will not overwrite a newer file on disk.
306 \fB\-V\fP, \fB\-Fl\fP dot
307 Print a dot to stderr for each file as it is processed.
311 \fB\-v\fP, \fB\-Fl\fP verbose
312 Print the name of each file to stderr as it is processed.
315 provide a detailed listing of each file.
318 Print the program version information and exit.
322 Compress the archive with bzip2-compatible compression before writing it.
323 In input mode, this option is ignored;
324 bzip2 compression is recognized automatically on input.
328 Compress the archive with compress-compatible compression before writing it.
329 In input mode, this option is ignored;
330 compression is recognized automatically on input.
334 Compress the archive with gzip-compatible compression before writing it.
335 In input mode, this option is ignored;
336 gzip compression is recognized automatically on input.
340 The \fBcpio\fP utility exits 0 on success, and >0 if an error occurs.
343 The following environment variables affect the execution of
351 for more information.
354 The timezone to use when displaying dates.
357 for more information.
363 command is traditionally used to copy file hierarchies in conjunction
367 The first example here simply copies all files from
372 \fB\%find\fP \fIsrc\fP | \fB\%cpio\fP \fB\-pmud\fP \fIdest\fP
375 By carefully selecting options to the
377 command and combining it with other standard utilities,
378 it is possible to exercise very fine control over which files are copied.
379 This next example copies files from
383 that are more than 2 days old and whose names match a particular pattern:
385 \fB\%find\fP \fIsrc\fP \fB\-mtime\fP \fI+2\fP | \fB\%grep\fP foo[bar] | \fB\%cpio\fP \fB\-pdmu\fP \fIdest\fP
388 This example copies files from
392 that are more than 2 days old and which contain the word
395 \fB\%find\fP \fIsrc\fP \fB\-mtime\fP \fI+2\fP | \fB\%xargs\fP \fB\%grep\fP -l foobar | \fB\%cpio\fP \fB\-pdmu\fP \fIdest\fP
399 The mode options i, o, and p and the options
400 a, B, c, d, f, l, m, r, t, u, and v comply with SUSv2.
402 The old POSIX.1 standard specified that only
407 were interpreted as command-line options.
408 Each took a single argument of a list of modifier
410 For example, the standard syntax allows
415 \fB\-i\fP \fB\-m\fP \fB\-u\fP,
420 are only modifiers to
422 they are not command-line options in their own right.
423 The syntax supported by this implementation is backwards-compatible
425 For best compatibility, scripts should limit themselves to the
436 \fBlibarchive-formats\fP(5),
440 There is no current POSIX standard for the cpio command; it appeared
442 ISO/IEC 9945-1:1996 (``POSIX.1'')
444 IEEE Std 1003.1-2001 (``POSIX.1'').
446 The cpio, ustar, and pax interchange file formats are defined by
447 IEEE Std 1003.1-2001 (``POSIX.1'')
455 utilities were written by Dick Haight
456 while working in AT&T's Unix Support Group.
457 They first appeared in 1977 in PWB/UNIX 1.0, the
458 ``Programmer's Work Bench''
459 system developed for use within AT&T.
460 They were first released outside of AT&T as part of System III Unix in 1981.
465 even though it was not well-known outside of AT&T until some time later.
467 This is a complete re-implementation based on the
472 The cpio archive format has several basic limitations:
473 It does not store user and group names, only numbers.
474 As a result, it cannot be reliably used to transfer
475 files between systems with dissimilar user and group numbering.
476 Older cpio formats limit the user and group numbers to
477 16 or 18 bits, which is insufficient for modern systems.
478 The cpio archive formats cannot support files over 4 gigabytes,
481 variant, which can support files up to 8 gigabytes.