cpio.1 (2010 09)
c
cpio(1) cpio(1)
NAME
cpio - copy file archives in and out; duplicate directory trees
SYNOPSIS
cpio -o [-e extarg ][
achnvxABC]
cpio -i[bcdfmnrstuvxBPRSU6
][pattern ...]
cpio -p [-e extarg ][
adlmnruvxU] directory
DESCRIPTION
The
cpio command saves and restores archives of files on magnetic tape, other devices, or a regular file,
and copies files from one directory to another while replicating the directory tree structure. When
cpio
completes processing the files, it reports the number of blocks written.
cpio -o (copy out, export) Read standard input to obtain a list of path names, and copy those files to
standard output together with path name and status information. The output is padded to a
512-byte boundary.
cpio -i (copy in, import) Extract files from standard input, which is assumed to be the result of a
previous cpio -o.
If pattern ..., is specified, only the files with names that match a pattern according to the
rules of Pattern Matching Notation (see regexp (5)) are selected. A leading
! on a pattern
indicates that only those names that do not match the remainder of the pattern should be
selected. Multiple patterns can be specified. The patterns are additive. If no pattern is
specified, the default is
* (select all files). See the f option, as well.
Extracted files are conditionally created and copied into the current directory tree, as deter-
mined by the options described below. The permissions of the files match the permissions of
the original files when the archive was created by
cpio -o unless the U
option is used.
File owner and group are that of the current user unless the user has appropriate privileges,
in which case
cpio retains the owner and group of the files of the previous
cpio -o.
cpio -p (pass through) Read standard input to obtain a list of path names of files which are then
conditionally created and copied into the destination directory tree as determined by the
options described below. directory must exist. Destination path names are interpreted rela-
tive to directory .
With the
-p option, when handling a link, only the link is passed and no data blocks are
actually read or written. This is especially noteworthy with cpio -pl, where it is very
possible that all the files are created as links, such that no blocks are written and "0 blocks"
is reported by cpio. (See below for a description of the -l option.)
Options
cpio recognizes the following options, which can be appended as appropriate to -i, -o
, and -p. White
space and hyphens are not permitted between these options and
-i, -o,or-p.
a Reset access times of input files after they are copied.
b Swap both bytes and half-words. Use only with -i. See the P option for details; see also
the s and S options.
c Write or read header information in ASCII character form for portability.
d Create directories as needed.
-e extarg
Specifies the handling of any extent attributes of the file(s) to be archived or copied.
extarg takes one of the following values.
warn Archive or copy the file and issue a warning message if extent attributes can-
not be preserved.
ignore Do not issue a warning message even if extent attributes cannot be preserved.
force Any file(s) with extent attributes will not be archived and a warning message
will be issued.
When using the
-o option, extent attributes are not preserved in the archive. Further-
more, the -p option will not preserve extent attributes if the files are being copied to a
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1