Cpio

From LQWiki
Jump to navigation Jump to search

cpio (copy input and output) is both a command and an archive file format. The cpio command can create archives in several formats, including it's own binary format and the more common tar format.

It isn't often used in the 'wild'. The tar command and archive format is the most commonly used. But rpm packages contain a cpio archive. A cpio archive can be extracted from a rpm file with the rpm2cpio tool.

Extracting a cpio archive

To extract a cpio archive (in this example initrd.img) into your current directory, use

cpio -i <initrd.img

Creating a cpio archive

To create a cpio archive, run

find * | cpio -o >test.cpio

Using cpio to copy hidden files

To copy all of the files, including hidden files in the current folder to /some/other/path enter:

$ find .* | cpio -pmudv /some/other/path

This uses the find command to send cpio a list of files on its standard input. If you want to exclude some files, you can filter the output of find through grep.

See also

External links

This article is a stub and needs to be finished. Plunge forward and help it grow!