A cpio archive is a stream of files and directories in a single archive, and often ends with a .cpio file extension. The archive has header information that allows for an application such as the GNU_cpio tool to extract the files and directories into a file system. The header of a cpio archive also contains information such as the file name, time stamp, owner and permissions.

Example use

If you wanted to archive an entire directory tree, the find command can provide the file list to cpio:

Cpio copies files from one directory tree to another, combining the copy-out and copy-in steps without actually using an archive. It reads the list of files to copy from the standard input; the directory into which it will copy them is given as a non-option argument.

To extract files from a cpio archive, pass the archive to cpio as its standard input.

The -i flag indicates that cpio is reading in the archive to extract files, and the -d flag tells cpio to construct directories as necessary. You can also use the -v flag to have file names listed as files are extracted.