CPIO(1) — USER COMMANDS
NAME
cpio − copy file archives in and out
SYNOPSIS
cpio −o [ acBvs ]
cpio −i [ Bcdmrtuv6s ] [ patterns ]
cpio −p [ adlmruvs ] directory
DESCRIPTION
Cpio -o (copy out) reads the standard input to get a list of pathnames, and then copies those files onto the standard output, together with pathname and status information.
Cpio −i (copy in) reads the standard input (which is assumed to be the product of a previous Cpio −o command), to get a list of files selected by zero or more patterns as defined in the name-generating notation of sh(1) or csh(1). In patterns, the meta-characters ?, ∗, and [...] match the slash (/) character. The default for patterns is ∗ (select all files).
Cpio −p (pass) copies out and in in a single operation. Destination pathnames are interpreted relative to the named directory.
OPTIONS
a Reset the access times of input files after they have been copied.
B Input/output is to be blocked at 5120 bytes to the record. This does not apply to the pass option. This option is only meaningful with data directed to or from /dev/rmt?
d Directories should be created as needed.
c Write header information in ASCII character form for portability.
r Interactively rename files. If the user types a null line, the file is skipped.
t Print a Table of contents of the input. No files are created.
u Copy unconditionally. Normally, an older file will not replace a newer file with the same name.
v Verbose option. A list of filenames is displayed. When used with the t option, the table of contents looks like the output of an ls −l command (see ls(1)).
l Whenever possible, link files rather than copying them. Usable only with the −p option.
m Retain previous file modification time. This option is ineffective on directories that are being copied.
6 Process an old (version 6 UNIX system) file. This is only useful with −i (copy in).
s Swaps pairs of data bytes. Note that the s option cannot be used with the c option.
EXAMPLES
To copy the contents of a directory into an archive:
% ls | cpio −o > /dev/mt0
To duplicate the olddir directory hierarchy in the newdir directory:
% cd olddir
% find . −print | cpio −pdl newdir
Some forms of cpio tapes from other sites have the bytes swapped in the file. The s option doesn’t help since it only swaps the data bytes and not the header. To overcome this problem, use dd with the conv=swab option to swap all pairs of bytes (including the header), then pipe the output of dd through cpio with the s option to swap the data bytes back again:
% dd if=whatever the file is conv=swab | cpio −is
SEE ALSO
BUGS
Pathnames are restricted to 128 characters. If there are too many unique linked files, cpio runs out of memory to keep track of them and linking information is lost thereafter. Only the super-user can copy special files.
Sun Release 1.1 — Last change: 1 November 1983