The cpio application accepts input filenames via stdin and it writes the archive to stdout. We have to redirect stdout to a file to save the cpio output:
- Create test files:
$ touch file1 file2 file3
- Archive the test files:
$ ls file* | cpio -ov > archive.cpio
- List files in a cpio archive:
$ cpio -it < archive.cpio
- Extract files from the cpio archive:
$ cpio -id < archive.cpio