Main index | Section 1 | Options |
The first option to cpio is a mode indicator from the following list:
|
Input.
Read an archive from standard input (unless overridden) and extract the
contents to disk or (if the
|
| Output. Read a list of filenames from standard input and produce a new archive on standard output (unless overridden) containing the specified items. |
| Pass-through. Read a list of filenames from standard input and copy the files to the specified directory. |
| |
Read filenames separated by NUL characters instead of newlines. This is necessary if any of the filenames being read might contain newlines. | |
| |
When reading a binary format archive, assume it's the earlier one, from the PWB variant of 6th Edition UNIX. When writing a cpio archive, use the PWB format. | |
| |
(o mode only) When writing a cpio archive, use the (newer, non-PWB) binary format. | |
| |
(o mode only) Append to the specified archive. (Not yet implemented.) | |
| |
(o and p modes) Reset access times on files after they are read. | |
| |
(o mode only) Block output to records of 5120 bytes. | |
| |
(o mode only) Block output to records of size bytes. | |
| |
(o mode only)
Use the old POSIX portable character format.
Equivalent to
| |
| |
(i and p modes) Create directories as necessary. | |
| |
(i mode only) Read list of file name patterns from file to list and extract. | |
| |
Read archive from or write archive to file. | |
| |
(i mode only) Ignore files that match pattern. | |
| |
(o mode only)
Produce the output archive in the specified format.
Supported formats include:
| |
cpio | Synonym for odc. |
newc | The SVR4 portable cpio format. |
odc | The old POSIX.1 portable octet-oriented cpio format. |
pax | The POSIX.1 pax format, an extension of the ustar format. |
ustar | The POSIX.1 tar format. |
The default format is odc. See libarchive-formats(5) for more complete information about the formats currently supported by the underlying libarchive(3) library.
| |
Print usage information. | |
| |
Read archive from file. | |
| |
Input mode. See above for description. | |
| |
(i and p mode only) Disable security checks during extraction or copying. This allows extraction via symbolic links, absolute paths, and path names containing '..' in the name. | |
| |
(o mode only) Compress the file with xz-compatible compression before writing it. In input mode, this option is ignored; xz compression is recognized automatically on input. | |
| |
Synonym for
| |
| |
(o and p modes) All symbolic links will be followed. Normally, symbolic links are archived and copied as symbolic links. With this option, the target of the link will be archived or copied instead. | |
| |
(p mode only) Create links from the target directory to the original files, instead of copying. | |
| |
(o mode only) Compress the resulting archive with lrzip(1). In input mode, this option is ignored. | |
| |
(o mode only) Compress the archive with lz4-compatible compression before writing it. In input mode, this option is ignored; lz4 compression is recognized automatically on input. | |
| |
(o mode only) Compress the archive with zstd-compatible compression before writing it. In input mode, this option is ignored; zstd compression is recognized automatically on input. | |
| |
(o mode only) Compress the file with lzma-compatible compression before writing it. In input mode, this option is ignored; lzma compression is recognized automatically on input. | |
| |
(o mode only) Compress the resulting archive with lzop(1). In input mode, this option is ignored. | |
| |
The passphrase is used to extract or create an encrypted archive. Currently, zip is only a format that cpio can handle encrypted archives. You shouldn't use this option unless you realize how insecure use of this option is. | |
| |
(i and p modes) Set file modification time on created files to match those in the source. | |
| |
(i mode, only with
| |
| |
(i mode only) Do not attempt to restore file ownership. This is the default when run by non-root users. | |
| |
Write archive to file. | |
| |
Output mode. See above for description. | |
| |
Pass-through mode. See above for description. | |
| |
(i mode only) Restore file ownership. This is the default when run by the root user. | |
| |
Suppress unnecessary messages. | |
| |
Set the owner and/or group on files in the output.
If group is specified with no user
(for example,
| |
| |
(All modes.) Rename files interactively. For each file, a prompt is written to /dev/tty containing the name of the file and a line is read from /dev/tty. If the line read is blank, the file is skipped. If the line contains a single period, the file is processed normally. Otherwise, the line is taken to be the new name of the file. | |
| |
(i mode only) List the contents of the archive to stdout; do not restore the contents to disk. | |
| |
(i and p modes) Unconditionally overwrite existing files. Ordinarily, an older file will not overwrite a newer file on disk. | |
| |
Print a dot to stderr for each file as it is processed.
Superseded by
| |
| |
Print the name of each file to stderr as it is processed.
With
| |
| |
Print the program version information and exit. | |
| |
(o mode only) Compress the archive with bzip2-compatible compression before writing it. In input mode, this option is ignored; bzip2 compression is recognized automatically on input. | |
| |
(o mode only) Compress the archive with compress-compatible compression before writing it. In input mode, this option is ignored; compression is recognized automatically on input. | |
| |
(o mode only) Compress the archive with gzip-compatible compression before writing it. In input mode, this option is ignored; gzip compression is recognized automatically on input. | |
LANG | The locale to use. See environ(7) for more information. |
TZ | The timezone to use when displaying dates. See environ(7) for more information. |
find
By carefully selecting options to the find(1) command and combining it with other standard utilities, it is possible to exercise very fine control over which files are copied. This next example copies files from src to dest that are more than 2 days old and whose names match a particular pattern:
find
This example copies files from src to dest that are more than 2 days old and which contain the word "foobar ":
find
The old POSIX.1 standard specified that only
The cpio, ustar, and pax interchange file formats are defined by IEEE Std 1003.1-2001 ("POSIX.1") for the pax command.
This is a complete re-implementation based on the libarchive(3) library.
CPIO (1) | September 16, 2014 |
Main index | Section 1 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.