Cpio

From Wikipedia, the free encyclopedia

The correct title of this article is cpio. The initial letter is shown capitalized due to technical restrictions.

cpio is both the name of a binary utility, and a form of digital archive. A cpio archive is essentially a stream of files and directories in a single archive. 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 filename, time stamps, owner and permissions.

The cpio archive is similar in function to that of a tar archive, and was designed to store backups onto a tape device in a contiguous manner.

A cpio archive will often end in a .cpio file extension. A cpio archive can also be compressed using gzip (for example,) at which point the file extension will usually become .cpio.gz.

The GNU cpio options are different from those used in FreeBSD.

Although the cpio utility was standardized in POSIX.1-1988 it was dropped from later revisions, starting with POSIX.1-2001, due to its 8GB filesize limit. The POSIX standardized pax utility can be used to read and write cpio archives instead.

Contents

[edit] GNU cpio

The GNU cpio application is a tool that can be used to put information into a cpio or tar archive. The cpio application is free software, and is available from the GNU web site.

[edit] Example use

To put files into a cpio archive using the GNU cpio tool, you can use the following command.

find MySourceDir -type f  | cpio -pvudm ~/MyDestinationDir

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

cpio -id < cpiofile

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.

[edit] See also

[edit] External links