Why is cpio better than tar? A number of reasons.
- cpio preserves hard links, which is important if you're using it for backups.
- cpio doesn't have that annoying filename length limitation. Sure, gnutar has a "hack" that allows you to use longer filenames (it creates a temporary file in which it stores the real name), but it's inherently not portable to non-gnu tar's.
- By default, cpio preserves timestamps
- When scripting, it has much better control over which files are and are not copied, since you must explicitly list the files you want copied. For example, which of the following is easier to read and understand?
root@server # pwd
find . | cpio -pdumv /opt/openwin
find /usr/openwin | cpio -pdumv /opt/openwin
find . -depth -print | cpio -pudmv /ftp/data2/pdu-msa/EDA-SLS
*** using -print will get you defunct when you exit the shell, use find . only