What is CPIO? Unix Copy In, Copy Out Archive Format Explained
A classic Unix archive format that streams files together with their metadata.
Last updated:
What is CPIO?
cpio, short for 'copy in, copy out', is a Unix utility and the associated archive format used to combine many files into a single stream. It originated in PWB/UNIX and was later standardized in the POSIX.1 specification.
The cpio program reads a list of file names from standard input and writes a concatenation of file headers, metadata, and contents to an archive. Several header variants exist, including the old binary, old ASCII (odc), and the SVR4 'new ASCII' (newc) formats, the last of which is widely used in Linux initramfs images and RPM payloads.
How CPIO Works
cpio is one of the oldest Unix archive formats, its name coming from copy in, copy out. Like tar it bundles many files into one stream without compressing them, preserving names, permissions, ownership, and timestamps. Where tar reads a directory tree itself, cpio takes a list of file paths on its input and archives exactly those, which makes it a natural partner for the find command.
The archive is a sequence of entries, each a header followed by the file's data. The header records the metadata (inode-style fields, mode, size, and name length) and is immediately followed by the filename and then the file contents. An entry with the special name TRAILER!!! marks the end of the archive, and there is no central index, so cpio is a pure serial stream just like tar.
cpio supports several header encodings. The newc format, an ASCII header layout, is the modern portable choice and is what Linux uses internally; older binary and ODC formats also exist and are why cpio archives can vary between systems. Because the format is just headers and data concatenated, it can be piped freely, and copying a tree is classically done as find . | cpio -pd target/.
As an archiver only, cpio is normally paired with a compressor for storage. A cpio stream fed through gzip is exactly how the Linux initramfs (the early-boot filesystem) is packaged, and the same cpio-plus-compression idea sits inside RPM packages, which is one of the main reasons the format is still encountered today.
History and Standardization
cpio originated in early Unix alongside tar and served the same tape-backup purpose. For a long time the two competed as the standard Unix archive tools, and the choice between them was often a matter of platform convention.
The format and its behaviour were standardized through POSIX, which defined the portable ASCII header formats so archives could move between systems. That standardization is why the newc format in particular can be relied on across modern Linux and Unix tooling.
While tar won the popularity contest for general use, cpio never disappeared because it became load-bearing in two important places: the Linux initramfs image that the kernel unpacks at boot, and the payload of RPM packages. Both keep cpio in active service on millions of systems even though users rarely invoke it directly.
CPIO Compared to TAR
cpio and tar do essentially the same job: serial, uncompressed archiving that preserves Unix metadata. The most visible difference is the interface. tar is given a directory and walks it itself, while cpio reads an explicit list of paths from its input, which makes cpio flexible for scripting with find but less convenient for a quick one-shot archive.
In practice tar became the default for user-facing archives and software distribution, helped by its simple tar czf ergonomics and the ubiquitous .tar.gz convention. cpio's multiple header variants and less friendly command line pushed it toward specialized, behind-the-scenes roles rather than everyday use.
Neither format compresses on its own, so both rely on gzip, bzip2, or xz for size. The lasting reason to know cpio is not that you will create one by hand, but that it is the container inside initramfs images and RPM packages, so understanding it helps when inspecting how a Linux system boots or how its software is packaged.
MKV Technical Specifications
CPIO vs Other Archive Formats
| Feature | CPIO | TAR | ZIP |
|---|---|---|---|
| Type | Stream archiver[2] | Stream archiver | Compressed archive |
| Built-in compression | No[1] | No | Yes |
| Standardized by | POSIX[3] | POSIX | PKWARE |
| OS support | Unix-like | Universal | Universal |
| Best for | RPM payloads, initramfs | Unix backups | General sharing |
CPIO and TAR bundle files without compressing them, whereas ZIP combines bundling and compression in one container.
Advantages & Disadvantages
Advantages
Stores ownership, permissions, timestamps, and device information, making it suitable for full system archiving.
Operates on a stream of files from standard input, which pipes cleanly with find and other Unix tools.
The format is described in POSIX.1, giving it a stable, well-documented specification.
Used as the payload container inside RPM packages and Linux initramfs images.
Disadvantages
cpio archives are uncompressed and must be paired with gzip or xz to reduce size.
Multiple incompatible header variants can cause confusion and portability issues.
Its command-line interface is considered less intuitive than tar for everyday use.
Common Use Cases
cpio is most often encountered in system-level archiving and Linux packaging.
RPM package payloads
RPM packages store their installable files in a cpio archive, typically compressed with gzip or xz.
Linux initramfs
The initial RAM filesystem loaded by the Linux kernel is packaged as a cpio archive.
System backups
Combined with find, cpio can archive directory trees while preserving file metadata.
Convert CPIO Files Free
Use our free online archive converter to convert CPIO and other formats - no signup, no watermarks.
Try Archive Converter FreeHow to open a CPIO file
Software for handling CPIO files can be categorized into professional applications, free/open-source tools, browser-based solutions, and built-in utilities. Professional applications often provide extensive features for advanced users, while free/open-source tools are suitable for those looking for cost-effective solutions. Browser-based options offer convenience and accessibility, whereas built-in utilities are typically available on Unix-like systems for quick access.
When choosing software for CPIO specifically, factors such as feature fidelity, whether you need editing or just viewing capabilities, and the cost model are crucial. Platform compatibility is also important, as some tools may only be available on specific operating systems. Additionally, consider export needs and whether converting CPIO to another format is a better solution for your workflow.
cpio 2023
cpio is a command-line utility for Unix-like systems that handles CPIO archives. It allows users to create, extract, and list the contents of CPIO files with high fidelity. This tool is particularly suited for users comfortable with terminal commands.
- Create CPIO archives from files
- Extract files from CPIO archives
- List contents of CPIO archives
- Support for various CPIO formats
- Integration with other Unix commands
- Native support on Unix-like systems
- Highly efficient for batch processing
- No additional installation required
- Command-line interface may intimidate beginners
- Limited graphical user interface options
Exports to: N/A
Best for: Choose cpio if you prefer a powerful command-line tool for managing CPIO files on Unix-like systems.
Visit cpio →Ark 21.12.3
Ark is a graphical archive manager for Linux that supports various archive formats, including CPIO. It provides a user-friendly interface for viewing and extracting files from CPIO archives, making it accessible for users who prefer GUI applications.
- Graphical interface for archive management
- Extract files from CPIO archives
- View contents of CPIO files
- Support for multiple archive formats
- Integration with file managers
- User-friendly graphical interface
- Supports multiple archive formats
- Easy integration with desktop environments
- Limited editing capabilities for CPIO files
- Primarily designed for extraction, not creation
Exports to: N/A
Best for: Select Ark if you need a user-friendly GUI tool for extracting and viewing CPIO files on Linux.
Visit Ark →The Unarchiver 4.3.0
The Unarchiver is a macOS application designed to handle various archive formats, including CPIO. It allows users to easily extract files from CPIO archives with a simple drag-and-drop interface, catering to users who prefer a straightforward extraction process.
- Drag-and-drop extraction of CPIO files
- Support for many archive formats
- Easy integration with Finder
- Automatic file association
- Quick extraction process
- Very easy to use for macOS users
- Supports a wide range of formats
- No complex settings to configure
- Limited functionality beyond extraction
- No support for creating CPIO archives
Exports to: N/A
Best for: Use The Unarchiver if you want a simple and effective tool for extracting CPIO files on macOS.
Visit The Unarchiver →7-Zip 22.01
7-Zip is a popular open-source file archiver that supports a wide variety of archive formats, including CPIO. It provides both a graphical interface and command-line options, allowing users to extract and create CPIO files with ease and flexibility.
- Create and extract CPIO archives
- Support for multiple archive formats
- High compression ratio
- Command-line interface available
- Integration with Windows Explorer
- Versatile with many archive formats
- Strong compression capabilities
- Available on multiple platforms
- Interface may seem outdated
- Complex for users unfamiliar with archiving
Exports to: ZIP, TAR, GZ, BZ2, XZ
Best for: Opt for 7-Zip if you need a versatile archiving tool that can handle CPIO files along with many other formats.
Visit 7-Zip →