How To Use Cpio In Linux? – POFTUT

How To Use Cpio In Linux?

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.

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.

  • -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

  • -F makes listing the files
List Files Inside Cpio Archive

List Files Inside Cpio Archive

Write Archive Into A Tape

We can write archive into a tape-like below.

Extract Archive

Extracting is easy as archiving. We will use -i and -F option.

echo '

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.

Track Operation With Verbose

Compression operation can be tracked by using verbose option which will give details about compression operation.

LEARN MORE  Linux ar Command Tutorial with Examples For Archiving

  • -v argument makes the command verbose

Supported Compression Algorithms and Formats

Leave a Reply

Your email address will not be published. Required fields are marked *