Arch manual pages


cpio - copy files to and from archives

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}

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.

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:

-o, --create
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.
-i, --extract
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.
-p, --pass-through
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.

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.
-C, --io-size=NUMBER
Set the I/O block size to the given NUMBER of bytes.
-D, --directory=DIR
Change to directory DIR.
Archive file is local, even if its name contains colons.
-H, --format=FORMAT
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 i-nodes. (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).
-R, --owner=[USER][:.][GROUP]
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.
-v, --verbose
Verbosely list the files processed.
-V, --dot
Print a "." for each file processed.
-W, --warning=FLAG
Controlsи warning display. 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.

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.
-M, --message=STRING
Print STRING when the end of a volume of the backup media is reached.

-b, --swap
Swap both halfwords of words and bytes of halfwords in the data. Equivalent to -sS.
-f, --nonmatching
Only copy files that do not match any of the given patterns.
-n, --numeric-uid-gid
In the verbose table of contents listing, show numeric UID and GID.
-r, --rename
Interactively rename files.
-s, --swap-bytes
Swap the bytes of each halfword in the files.
-S, --swap-halfwords
Swap the halfwords of each word (4 bytes) in the files.
Extract files to standard output.
-E, --pattern-file=FILE
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.

-A, --append
Append to an existing archive.
--device-independent, --reproducible
Create reproducible archives. This is equivalent to --ignore-devno --renumber-inodes.
Store 0 in the device number field of each archive member, instead of the actual device number.
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 wither using this option, or using -F (--file), but not both.

Renumber inodes when storing them in the archive.

-l, --link
Link files instead of copying them, when possible.

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

-0, --null
Filenames in the list are delimited by null characters instead of newlines.
-a, --reset-access-time
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 wither using this option, or using -F (--file), but not both.

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

-d, --make-directories
Create leading directories where needed.
-m, --preserve-modification-time
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.
-u, --unconditional
Replace all files unconditionally.

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

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

Report bugs to <>.

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

December 1, 2014 CPIO