Using cpio

From KG7QIN's Wiki
Revision as of 17:24, 7 July 2024 by Kg7qin (talk | contribs) (Created initial page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Various notes on using the cpio command.

Create *.cpio archive

 ls | cpio -ov -H tar -F sample.tar

Extract *.cpio archive

 cpio -idv < /tmp/object.cpio

Create *.cpio archive with selected files

 find . -iname *.c -print | cpio -ov >/tmp/c_files.cpio

Creating .tar files

The following will create .tar files using the cpio command:

 ls | cpio -ov -H tar -F sample.tar

Extract .tar archive

 cpio -idv -F sample.tar

View contents of .tar archive

 cpio -it -F sample.tar

Create *.cpio archive with original files and symlinks

 ls | cpio -oLv >/tmp/test.cpio

Preserve modification times while restoring *.cpio

 ls | cpio -omv >/tmp/test.cpio

Directory copy

 find . -depth | cpio -pmdv /mnt/out