Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)
User Commands (c) cpio(1)
cpio -o (Copy Out)
This command reads file pathnames from the standard input file and copies these files to the stan-
dard output file along with pathnames and status information. Output is padded to a 512-byte
boundary.
cpio -i (Copy In)
This command reads an archive file created by the cpio -o command from the standard input file
and copies from it the files with names that match pattern. These files are copied into the current
directory tree. Permissions of the new files are the same as the permissions associated with the
files copied using cpio -o. The owner and group of the new files are those of the current user,
unless that user has appropriate privileges; if the user has appropriate privileges, cpio retains the
owner and group of the files copied using cpio -o. Only a user with appropriate privileges can
extract block special or character special files from an archive.
You can list more than one pattern operand using the filename notation described in the sh(1)
reference page. Note, however, that in the cpio command the special characters * (asterisk), ?
(question mark), and [](brackets) match the / (slash) in pathnames, in addition to their use as
described for the sh command. The default pattern is *, which selects all files in the archive. In
an expression such as [a-z], the dash means "through" according to the current collating
sequence. The collating sequence is determined by the LC_COLLATE environment variable.
cpio -p (Directory Copy)
This command reads file pathnames from the standard input file and copies these files into the
directory named by directory. The specified directory must already exist. If these pathnames
include directory names and if these directories do not already exist, you must use the -d flag to
cause the directories to be created.
Note that you can copy special files only if you have appropriate privileges. Pathnames cannot
exceed 128 bytes. Avoid giving cpio pathnames made up of many uniquely linked files, because
cpio might not have enough memory to keep track of them and could lose linking information.
For filesets that support OSS access control lists (ACLs), this command also copies any ACL |
entries associated with the file, so that the copied file has the same ACL entries as the source file.
Environment Variables
This command supports the use of the LANG, LC_ALL, LC_COLLATE, LC_CTYPE,
LC_MESSAGES, LC_TIME, NLSPATH, and TZ environment variables.
CAUTIONS
When redirecting the output from cpio to a special file (device), redirect it to the raw device and
not the block device. Because writing to a block device is done asynchronously, there is no way
to know whether the end of the device has been reached.
EXIT VALUES
The exit values for cpio are as follows:
0 (zero) The command executed successfully.
>0 An error occurred. If a file or directory cannot be created or overwritten, cpio
continues with the next file in the archive or the next file to be added to the
archive.
527188-007 Hewlett-Packard Company 2−77