Copy in (extract) files whose names match selected
Each pattern can include filename metacharacters from the Bourne shell.
(Patterns should be quoted or escaped so they are interpreted by
cpio, not by the shell.) If no pattern is used, all files are
During extraction, existing files are not overwritten by older versions
in the archive (unless -u is specified).
Copy out a list of files whose names are given on the standard input.
Copy files to another directory on the same system. Destination pathnames
are interpreted relative to the named
Options available to the -i, -o, and -p flags
are shown respectively in the first, second, and third row below.
- is omitted for clarity.)
i: 6 b B c C d E f H I k m M r R s S t u v V
o: a A B c C H L M O v V
p: a d l L m R u v V
Reset access times of input files.
Append files to an archive (must use with -O).
Swap bytes and half-words. Words are 4 bytes.
Block input or output using 5120 bytes per record (default is 512 bytes per record).
Read or write header information as ASCII characters; useful when source and destination machines are of differing types.
Like B, but block size can be any positive integer
Create directories as needed.
Extract filenames listed in
file from the archives.
Reverse the sense of copying; copy all files
except those that
Read or write header information according to
Values for format are crc (ASCII header containing expanded
device numbers), odc (ASCII header containing small device numbers),
ustar (IEEE/P1003 Data Interchange Standard header), or
tar (tar header).
file as an input archive.
Skip corrupted file headers and I/O errors.
Link files instead of copying.
Follow symbolic links.
Retain previous file modification time.
msg when switching media.
Use variable %d in the message as a numeric ID for the next medium.
-M is valid only with -I or -O.
Direct the output to
Rename files interactively.
Reassign file ownership and group information to the user's login
(privileged users only).
Print a table of contents of the input (create no files). When used with the -v option, resembles output of ls -l.
Unconditional copy; old files can overwrite new ones.
Print a list of filenames.
Print a dot for each file read or written (this shows cpio at work without cluttering the screen).
Process a UNIX 6th Edition archive format file.
Generate a list of old files using find; use list as input to cpio:
find . -name "*.old" -print | cpio -ocBv\ > /dev/rst8
Restore from a tape drive all files whose name contains "save" (subdirectories are created if needed):
cpio -icdv "save" < /dev/rst8
To move a directory tree:
find . -depth -print | cpio -padm /mydir