OpenBSD manual page server

Manual Page Search Parameters

CPIO(1) General Commands Manual CPIO(1)

cpiocopy file archives in and out

cpio -o [-AaBcLvZz] [-C bytes] [-F archive] [-H format] [-O archive] < name-list [> archive]

cpio -i [-6BbcdfmrSstuvZz] [-C bytes] [-E file] [-F archive] [-H format] [-I archive] [pattern ...] [< archive]

cpio -p [-adLlmuv] destination-directory < name-list

The cpio command copies files to and from a cpio archive. If the archive is of the form: [[user@]host:]file then the archive will be processed using rmt(8).

The options are as follows:

, --create
Create an archive. Reads the list of files to store in the archive from standard input, and writes the archive on standard output.
, --reset-access-time
Reset the access times on files that have been copied to the archive.
, --append
Append to the specified archive.
Set block size of output to 5120 bytes.
Use ASCII format for cpio header for portability.
bytes
Set the block size of output to bytes.
archive
 
archive
Use the specified file name as the archive to write to.
format
Write the archive in the specified format. Recognized formats are:

bcpio
Old binary cpio format.
cpio
Old octal character cpio format.
sv4cpio
SVR4 hex cpio format.
tar
Old tar format.
ustar
POSIX ustar format.
Follow symbolic links.
Be verbose about operations. List filenames as they are written to the archive.
--xz
Compress/decompress archive using xz(1) format.
Compress archive using compress(1) format.
Compress/decompress archive using gzip(1) format.
, --extract
Restore files from an archive. Reads the archive file from standard input and extracts files matching the patterns that were specified on the command line.
Do byte and word swapping after reading in data from the archive, for restoring archives created on systems with a different byte order.
Set the block size of the archive being read to 5120 bytes.
Expect the archive headers to be in ASCII format.
bytes
Read archive written with a block size of bytes.
, --make-directories
Create any intermediate directories as needed during restore.
file, --pattern-file file
Read list of file name patterns to extract or list from file.
, --nonmatching
Restore all files except those matching the patterns given on the command line.
archive, --file archive
 
archive
Use the specified file as the input for the archive.
format, --format format
Read an archive of the specified format. Recognized formats are:

bcpio
Old binary cpio format.
cpio
Old octal character cpio format.
sv4cpio
SVR4 hex cpio format.
tar
Old tar format.
ustar
POSIX ustar format.
Restore modification times on files.
, --rename
Rename restored files interactively.
Swap bytes after reading data from the archive.
, --swap-halfwords
Swap words after reading data from the archive.
, --list
Only list the contents of the archive, no files or directories will be created.
, --unconditional
Overwrite files even when the file in the archive is older than the one that will be overwritten.
, --verbose
Be verbose about operations. List filenames as they are copied in from the archive.
Uncompress archive using gzip(1) format.
Uncompress archive using compress(1) format.
Process old-style cpio format archives.
, --pass-through
Copy files from one location to another in a single pass. The list of files to copy are read from standard input and written out to a directory relative to the specified directory argument.
Reset the access times on files that have been copied.
Create any intermediate directories as needed to write the files at the new location.
, --link
When possible, link files rather than creating an extra copy.
, --dereference
Follow symbolic links.
, --preserve-modification-time
Restore modification times on files.
, --unconditional
Overwrite files even when the original file being copied is older than the one that will be overwritten.
, --verbose
Be verbose about operations. List filenames as they are copied.
--force-local
Do not interpret filenames that contain a ‘:’ as remote files.
--insecure
Normally cpio ignores filenames that contain “..” as a path component. With this option, files that contain “..” can be processed.

cpio will exit with one of the following values:

0
All files were processed successfully.
1
An error occurred.

Whenever cpio cannot create a file or a link when extracting an archive or cannot find a file while writing an archive, or cannot preserve the user ID, group ID, file mode, or access and modification times when the -p option is specified, a diagnostic message is written to standard error and a non-zero exit value will be returned, but processing will continue. In the case where cpio cannot create a link to a file, cpio will not create a second copy of the file.

If the extraction of a file from an archive is prematurely terminated by a signal or error, cpio may have only partially extracted the file the user wanted. Additionally, the file modes of extracted files and directories may have incorrect file bits, and the modification and access times may be wrong.

If the creation of an archive is prematurely terminated by a signal or error, cpio may have only partially created the archive which may violate the specific archive format specification.

pax(1), tar(1)

Keith Muller at the University of California, San Diego.

The -s and -S options are currently not implemented.

June 18, 2011 NetBSD-7.0.1