If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):
Message-ID:
<37601D91.A0B559ED@aplawrence.com>
Subject: Re: cpio
References:
<19990610160534.07641.00000205@ng-ca1.aol.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
It sometimes surprises me that people have trouble with cpio. Not that its usage is at all obvious, but the man or info pages are usually packed with multple examples, and a web search will turn up thousands more.
Probably the two most important things to understand is that the normal use of cpio for creating archives is to feed a list of files to its standard input, and send the output to a storage device or a file. So usually you'll be using a program like "find":
find . | cpio -ocv > /tmp/archive.cpio
Becase cpio reads files from stdin in, you can use it interactively:
cpio -ocv > /tmp/archive.cpio
will hang, waiting for you to type file names. Type in pathnames, pressing enter after each one, and finish with a CTRL-D on a line by itself.
For restoration, if you want everything, a simple:
cpio -ivdum < /tmp/archive.cpio
may be all you need. If you left off " < /tmp/archive.cpio", cpio is just going to sit there and hang, doing nothing.
By the way, that "c" flag in the creation example is supposed to give you compatibility, but it may not: see I can't read a cpio archive created on a Linux box- it fails with "premature end of file". I Used the "c" flag which should give me compatibility..
I often use cpio to copy one directory to a new drive:
cd /data
find . | cpio -pdmv /newdrive/data
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)
| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 1 | 9 | 11 | 11 | 3,158 |
/Bofcusm/55.html copyright 1997-2004 (various authors) All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Click here to add your comments