Using cpio to Back Up and Restore Files

You will find that this section on cpio uses much of the same wording as in the previous section on tar. The two commands have similar functionality, and only some specific details and examples change the two sections. The tar and cpio sections are complete in themselves, without complicated references to one another, but if you read them both, you’ll get a strong sense of déjà vu.

Backing Up a Directory Subtree

cpio stands for copy in/out and it enables you to back up files to tape, disk, or a disk file. Here is an example of a basic cpio command to back up one complete directory:

$ cd /usr/fred/projects
$ find . -print | cpio -ocvaB > /dev/XXX?

First use cd to change the directory to back up. Then use ...

Get Practical UNIX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.