cpio
is general file archiver used in Linux, Unix and BSD systems. It is created as a tape archive tool but gained new features along with development. Cpio has its own compression format and extension.
Creating Archive With Cpio
We can create an archive file with cpio by getting find output.
find . -depth -print | cpio -o > ../perl5.cpio
We use find to list all files in the current working path and print all of them to the cpio to compress with its format.
We can create a tar archive with cpio by specifying the compression algorithm as tar.
$ find . -depth -print | cpio -H tar -o > ../perl5.tar
- `-o` is the output file
- `-H tar` specifies the compression algorithm will be tar
List Files Inside Cpio Archive
We can list files inside a cpio archive
$ cpio -i -F ../perl5.cpio
- -F makes listing the files

Write Archive Into A Tape
We can write archive into a tape-like below.
$ find . -depth -print | cpio -H tar -F /dev/nst1
Extract Archive
Extracting is easy as archiving. We will use -i
and -F
option.
$ cpio -i -F /dev/nst1
All files will be extracted to their original paths
Archive Into Remote System Tape
This is a very useful and practical solution. Archiving can be done to the remote system tape file like below.
$ find . -depth -print | cpio -H tar -F /dev/nst1 ismail@poftut1:/dev/nst1 --rsh-command=/usr/bin/ssh
Track Operation With Verbose
Compression operation can be tracked by using verbose option which will give details about compression operation.
$ cpio -v -i -F /dev/nst1
- -v argument makes the command verbose
Supported Compression Algorithms and Formats
`bin' The obsolete binary format. `odc' The old (POSIX.1) portable format. `newc' The new (SVR4) portable format, which supports file systems having more than 65536 i-nodes. `crc' The new (SVR4) portable format with a checksum (Sum32) added. `tar' The old tar format. `ustar' POSIX.1 tar format. Also recognizes GNU tar archives, which are similar but not identical. `hpbin'The obsolete binary format used by HPUX's cpio (which stores device files differently). `hpodc' The portable format used by HPUX's cpio (which stores device files differently).