Scroll to navigation

CPIO(1) GNU CPIO CPIO(1)

NAME

cpio - copy files to and from archives

SYNOPSIS

cpio {-o|--create} [-0acvABLV] [-C BYTES] [-H FORMAT] [-M MESSAGE] [-O [[USER@]HOST:]ARCHIVE] [-F [[USER@]HOST:]ARCHIVE] [--file=[[USER@]HOST:]ARCHIVE] [--format=FORMAT] [--message=MESSAGE] [--null] [--reset-access-time] [--verbose] [--dot] [--append] [--block-size=blocks] [--dereference] [--io-size=BYTES] [--quiet] [--force-local] [--rsh-command=COMMAND] < name-list [> archive]

cpio {-i|--extract} [-bcdfmnrtsuvBSV] [-C BYTES] [-E FILE] [-H FORMAT] [-M MESSAGE] [-R [USER][:.][GROUP]] [-I [[USER@]HOST:]ARCHIVE] [-F [[USER@]HOST:]ARCHIVE] [--file=[[USER@]HOST:]ARCHIVE] [--make-directories] [--nonmatching] [--preserve-modification-time] [--numeric-uid-gid] [--rename] [--list] [--swap-bytes] [--swap] [--dot] [--unconditional] [--verbose] [--block-size=BLOCKS] [--swap-halfwords] [--io-size=BYTES] [--pattern-file=FILE] [--format=FORMAT] [--owner=[USER][:.][GROUP]] [--no-preserve-owner] [--message=MESSAGE] [--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc] [--to-stdout] [--quiet] [--rsh-command=COMMAND] [pattern...] [< archive]

cpio {-p|--pass-through} [-0adlmuvLV] [-R [USER][:.][GROUP]] [--null] [--reset-access-time] [--make-directories] [--link] [--quiet] [--preserve-modification-time] [--unconditional] [--verbose] [--dot] [--dereference] [--owner=[USER][:.][GROUP]] [--no-preserve-owner] [--sparse] destination-directory < name-list

cpio {-?|--help|--usage|--version}

NOTE

This manpage is a short description of GNU cpio. For a detailed discussion, including examples and usage recommendations, refer to the GNU Cpio Manual available in texinfo format. If the info reader and the cpio documentation are properly installed on your system, the command

info cpio

should give you access to the complete manual.

You can also view the manual using the info mode in emacs(1), or find it in various formats online at

If any discrepancies occur between this manpage and the GNU Cpio Manual, the later shall be considered the authoritative source.

DESCRIPTION

GNU cpio copies files between archives and directories. It supports the following archive formats: old binary cpio, old portable cpio, SVR4 cpio with and without checksum, HP cpio, and various tar formats.

The operation mode is requested by one of the following options:

Copy-out. Read a list of file names from the standard input and create on the standard output (unless overridden by the --file option) an archive containing these files.
Copy-in. Read the archive from standard input (or from the file supplied with the --file option) and extract files from it, or (if the -t option is given) list its contents to the standard output. If one or more patterns are supplied, read or list only files matching these patterns. The -t option alone implies -i.
Pass-through. Read a list of file names from the standard input and copy them to the specified directory.
-?, --help
Give a short help summary and exit.
Print a short usage message and exit.
Print program version and exit.

OPTIONS

Operation modifiers valid in any mode

Set the I/O block size to BLOCK-SIZE * 512 bytes.
Set the I/O block size to 5120 bytes.
Use the old portable (ASCII) archive format. This is the same as -H odc.
Set the I/O block size to the given NUMBER of bytes.
Change to directory DIR.
Archive file is local, even if its name contains colons.
Use given archive FORMAT. Valid formats are (the number in parentheses gives maximum size for individual archive member):
The obsolete binary format. (2147483647 bytes)
The old (POSIX.1) portable format. (8589934591 bytes)
The new (SVR4) portable format, which supports file systems having more than 65536 inodes. (4294967295 bytes)
The new (SVR4) portable format with a checksum added.
The old tar format. (8589934591 bytes)
The POSIX.1 tar format. Also recognizes GNU tar archives, which are similar but not identical. (8589934591 bytes)
The obsolete binary format used by HPUX's cpio (which stores device files differently).
The portable format used by HPUX's cpio (which stores device files differently).
In copy-in and copy-pass mode, set the ownership of all files created to the specified USER and/or GROUP. In copy-out mode, store the supplied owner information in the archive.

USER and GROUP are first looked up in the system user and group databases. If not found, cpio checks if they consist of decimal digits only and, if so, treats them as numeric UID and GID, correspondingly.

To avoid the lookup and ensure that arguments are treated as numeric values, prefix them with a plus sign, e.g.: -R +0:+0.

Do not print the number of blocks copied at the end of the run.
Use remote COMMAND instead of rsh.
Verbosely list the files processed.
Print a "." for each file processed.
Controls what warnings are displayed. The FLAG is one of none, to disable all warnings, all to enable them, truncate, to enable warnings about field truncation, and no-truncate, to disable them.

Multiple -W options accumulate.

Operation modifiers valid in copy-in and copy-out modes

Use this ARCHIVE-FILE instead of standard input (in copy-in mode) or standard output (in copy-out mode). Optional USER and HOST specify the user and host names in case of a remote archive.
Print STRING when the end of a volume of the backup media is reached.

Operation modifiers valid only in copy-in mode

Swap both halfwords of words and bytes of halfwords in the data. Equivalent to -sS.
Only copy files that do not match any of the given patterns.
In the verbose table of contents listing, show numeric UID and GID.
Interactively rename files.
Swap the bytes of each halfword in the files.
Swap the halfwords of each word (4 bytes) in the files.
Extract files to standard output.
Read additional patterns specifying filenames to extract or list from FILE.
When reading a CRC format archive, only verify the CRC's of each file in the archive, without actually extracting the files.

Operation modifiers valid only in copy-out mode

Append to an existing archive.
Create reproducible archives. This is equivalent to --ignore-devno --ignore-dirnlink --renumber-inodes.
Store 0 in the device number field of each archive member, instead of the actual device number.
Store 2 in the nlink field of each directory archive member, instead of the actual number of links.
Use ARCHIVE-NAME instead of standard output. Optional USER and HOST specify the user and host names in case of a remote archive.

The output archive name can be specified either using this option, or using -F (--file), but not both.

Renumber inodes when storing them in the archive.

Operation modifiers valid only in copy-pass mode

Link files instead of copying them, when possible.

Operation modifiers valid in copy-in and copy-out modes

Do not strip file system prefix components from the file names. This is the default.
Create all files relative to the current directory.

Operation modifiers valid in copy-out and copy-pass modes

-0, --null
Filenames in the list are delimited by null characters instead of newlines.
Reset the access times of files after reading them.
Use ARCHIVE-NAME instead of standard input. Optional USER and HOST specify the user and host names in case of a remote archive.

The input archive name can be specified either using this option, or using -F (--file), but not both.

Dereference symbolic links (copy the files that they point to instead of copying the links).

Operation modifiers valid in copy-in and copy-pass modes

Create leading directories where needed.
Retain previous file modification times when creating files.
Do not change the ownership of the files.
Write files with large blocks of zeros as sparse files.
Replace all files unconditionally.

RETURN VALUE

GNU cpio exits with code 0 if it was able to successfully complete the requested operation. On errors, it exits with code 2.

SEE ALSO

tar(1), rmt(8), mt(1).

BUG REPORTS

Report bugs to <bug-cpio@gnu.org>.

COPYRIGHT

Copyright © 2014--2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

April 29, 2023 CPIO