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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.