cpio

Cpio is an archiver and file format from the Unix environment, the (but not at the command -line interface ) command is similar to tar in its basic functioning. The abbreviation cpio stands for "copy in, copy out". With cpio files can be sequentially written to an archive file or on magnetic tape. cpio files are often provided with the file extension. cpio. Just as tar files cpio archives are greater than the sum of the individual files contained in the archive, so that under certain circumstances, data compression is useful. To compress for Unix usually compress, gzip or bzip2.

The SVR4 version of cpio commands can next several cpio formats, use tar archive formats. GNU cpio has copied this behavior. A program which uses a similar format to the cpio file format is afio. From afio generated archives but can not always be read by cpio because of differences in the archive format, which are usually also only find in the middle of these archives.

POSIX standard

Cpio is included in the POSIX.1 -1988 standard. For later versions, from POSIX.1 -2001, it was removed due to its maximum file size of 4 GB / 2 GB ( when non-standard SVR4 format ) or 8 GB ( the POSIX cpio format). This decision was also influenced by the fact that the cpio archive format is not extensible without creating a completely new format of cpio family. However, the new POSIX command pax supports both the tar and the cpio format. The name pax ( Latin for " peace ") was as a result of the so-called Tar Wars (which were conducted around the year 1992 ) was chosen in order to create peace between the two rival programs cpio and tar.

Operation and Example Views

Cpio has four basic functions, which of the options -o ( " copy- out mode ," creating an archive ), -i ( "copy -in mode ", extracting from an archive ), -p ( "Copy- pass mode " copying directory trees ) and -t ( " List mode " ) can be specified. cpio basically works like other Unix - filter, ie, it expects its arguments from the input data stream and sends its results to the output data stream.

Creating a cpio file that contains the files of the current directory:

Ls | cpio -o > verzeichnis.cpio Creating a cpio file that contains the files and subdirectories in the current directory:

Place. -depth -print | cpio -o > verzeichnis.cpio Recover files from a cpio archive:

Cpio -i < archiv.cpio Without extracting list the files contained in the archive this:

Cpio - it < archiv.cpio Copy of the current directory and sub-directory to / tmp / directory ( roughly equivalent to cp -r * / tmp / directory ):

Place. -print- depth | cpio -pd / tmp / directory Comparison between cpio and tar

Of the two Unix commands cpio and tar tar is known and more widespread and is not subject to the size restriction for archive files of 4 GB (2 GB for implementations with signed int for the file size ) for the SVr4 format or 8 GB for the POSIX format. From the advocates of cpio is stated there in the cpio format usually no compatibility issues between different Unix platforms. A closer look at the results, however, as misperception, because there are four mutually completely incompatible cpio formats, and in addition problems with the byte order. Another comparison can be found in GNU tar manual. There you will find a lot to the formats that are partially supported by GNU cpio, this information is but partially applicable only in the GNU implementation, which is not fully compatible with the UNIX cpio.

The original cpio implementation has an undocumented feature and behaves similarly to the install program. This can be used with cpio files on just extract the program files and libraries, while ensuring that comes to program crashes.

Because the cpio formats have been defined so that any extension leads to a completely new, incompatible archive format, the POSIX cpio format in 2001 was designated as POSIX.1 -2001 does not forward-looking. The current preferred POSIX archive format called pax, and is an arbitrarily extensible variant of the tar format.

Use

Nowadays cpio is mainly used in the initramfs, the successor to the initrd. Also use rpm packages internally the cpio format.

202284
de