cpio (abbr. from English. Copy Input / Output ) - binary archiver and file format . The cpio utility was used as a tape archiver, originally part of PWB / UNIX , as well as part of UNIX System III and UNIX System V. However, the use of tar , which was an integral part of Research Unix , due to which it became easily accessible, led to the idea that it was a more convenient solution. [1] But the use of cpio by the RPM package manager, initramfs of the Linux kernel version 2.6, as well as the installer of the pax archives from Apple allowed cpio to remain one of the important archive formats in the future.
| Cpio | |
|---|---|
| Type of | Archiver |
| Developer | GNU Project |
| Written on | C |
| operating system | Unix-like |
| Latest version | 2.12 ( September 12, 2015 ) |
| License | GPL |
| Site | gnu.org/software/cpio/ |
Content
cpio archive
Archiving cpio, in fact, is a stream of files and directories in a single archive, often with the extension .cpio . The archive has header information that allows an application, such as, for example, GNU cpio, to extract files and directories to the file system. The cpio archive header also contains additional information, such as file name, creation time, owner and access rights (permissions).
The cpio archive is similar in functionality to the tar archive and was created to store backups on tape devices (for example, tape drives ) in a sequential way. Like the tar format , CPIO archives are often compressed using Gzip and delivered as files with the extension .cpgz (or .cpio.gz ).
Oracle supplies a significant portion of its cpio software.
POSIX and cpio
The cpio utility was standardized in POSIX .1-1988 . However, this had to be abandoned in future versions, starting with POSIX.1-2001 , due to a limit of 8 GB per file. POSIX announces the pax utility as a standard, which can be used instead of cpio to read and create archives.
GNU cpio
The GNU cpio application is a simple tool that can be used to put information in a cpio or tar format archive. The cpio app is free and available on the GNU official website .
Use
Archive
If you want to archive the entire directory tree (before this: cd is the desired folder), then the find command can transfer the list of files and folders to cpio:
find ./* | cpio -o> tree.cpio
Copy
Cpio copies files from one directory tree to another, while combining the copy-out and copy-in steps without the βrealβ use of archiving. It reads a list of files to copy from standard input; The destination directory to which you want to copy them is indicated as a required argument.
find. -depth -print0 | cpio βnull -pvd new-dir
Extract
To extract files from a cpio archive, pass the archive name to the cpio utility through standard input.
Note: This will overwrite without confirmation.
cpio -id <cpiofile
The -i flag tells cpio to read the archive for file extraction, and the -d flag tells cpio to create appropriate directories if necessary. You can also specify the -v flag to list the names of the extracted files.
All additional command line arguments are shell-shaped glob templates; only those files in the archive whose names match at least one template can be copied from the archive. The following example extracts etc / fstab from the archive (the format of the contents of the archive must first be checked with the cpio -l to verify how the path is stored):
cpio -id etc / fstab <cpiofile
See also
- UNIX-like operating system programs
- List of archive formats
Notes
- β Peek J, O'Reilly T, Loukides M. 1997. Unix Power Tools. O'Reilly & Associates, Inc. ISBN 1-56592-260-3 .