source: trunk/essentials/app-arch/cpio/doc/cpio.info~

Last change on this file was 3332, checked in by bird, 18 years ago

cpio 2.7

File size: 18.2 KB
Line 
1This is cpio.info, produced by makeinfo version 4.7 from
2/home/gray/gnu/cpio/doc/cpio.texi.
3
4INFO-DIR-SECTION Archiving
5START-INFO-DIR-ENTRY
6* Cpio: (cpio). Copy-in-copy-out archiver to tape or disk.
7END-INFO-DIR-ENTRY
8
9 This manual documents GNU cpio (version 2.6, 22 December 2004).
10
11 Copyright (C) 1995, 2001, 2002, 2004 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this
14 document under the terms of the GNU Free Documentation License,
15 Version 1.2 or any later version published by the Free Software
16 Foundation; with no Invariant Sections, with the Front-Cover texts
17 being "A GNU Manual", and with the Back-Cover Texts as in (a)
18 below. A copy of the license is included in the section entitled
19 "GNU Free Documentation License".
20
21 (a) The FSF's Back-Cover Text is: "You have freedom to copy and
22 modify this GNU Manual, like GNU software. Copies published by
23 the Free Software Foundation raise funds for GNU development."
24
25
26File: cpio.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
27
28cpio
29****
30
31GNU cpio is a tool for creating and extracting archives, or copying
32files from one place to another. It handles a number of cpio formats as
33well as reading and writing tar files. This is the first edition of the
34GNU cpio documentation and is consistant with 2.6.
35
36* Menu:
37
38* Introduction::
39* Tutorial:: Getting started.
40* Invoking `cpio':: How to invoke `cpio'.
41* Media:: Using tapes and other archive media.
42* Concept Index:: Concept index.
43
44 --- The Detailed Node Listing ---
45
46Invoking cpio
47
48* Copy-out mode::
49* Copy-in mode::
50* Copy-pass mode::
51* Options::
52
53
54File: cpio.info, Node: Introduction, Next: Tutorial, Prev: Top, Up: Top
55
561 Introduction
57**************
58
59GNU cpio copies files into or out of a cpio or tar archive, The archive
60can be another file on the disk, a magnetic tape, or a pipe.
61
62 GNU cpio supports the following archive formats: binary, old ASCII,
63new ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar.
64The tar format is provided for compatability with the tar program. By
65default, cpio creates binary format archives, for compatibility with
66older cpio programs. When extracting from archives, cpio automatically
67recognizes which kind of archive it is reading and can read archives
68created on machines with a different byte-order.
69
70
71File: cpio.info, Node: Tutorial, Next: Invoking `cpio', Prev: Introduction, Up: Top
72
732 Tutorial
74**********
75
76GNU cpio performs three primary functions. Copying files to an
77archive, Extracting files from an archive, and passing files to another
78directory tree. An archive can be a file on disk, one or more floppy
79disks, or one or more tapes.
80
81 When creating an archive, cpio takes the list of files to be
82processed from the standard input, and then sends the archive to the
83standard output, or to the device defined by the `-F' option. *Note
84Copy-out mode::. Usually find or ls is used to provide this list to
85the standard input. In the following example you can see the
86possibilities for archiving the contents of a single directory.
87
88 % ls | cpio -ov > directory.cpio
89
90 The `-o' option creates the archive, and the `-v' option prints the
91names of the files archived as they are added. Notice that the options
92can be put together after a single `-' or can be placed separately on
93the command line. The `>' redirects the cpio output to the file
94`directory.cpio'.
95
96 If you wanted to archive an entire directory tree, the find command
97can provide the file list to cpio:
98
99 % find . -print -depth | cpio -ov > tree.cpio
100
101 This will take all the files in the current directory, the
102directories below and place them in the archive tree.cpio. Again the
103`-o' creates an archive, and the `-v' option shows you the name of the
104files as they are archived. *Note Copy-out mode::. Using the `.' in
105the find statement will give you more flexibility when doing restores,
106as it will save file names with a relative path vice a hard wired,
107absolute path. The `-depth' option forces `find' to print of the
108entries in a directory before printing the directory itself. This
109limits the effects of restrictive directory permissions by printing the
110directory entries in a directory before the directory name itself.
111
112 Extracting an archive requires a bit more thought because cpio will
113not create directories by default. Another characteristic, is it will
114not overwrite existing files unless you tell it to.
115
116 % cpio -iv < directory.cpio
117
118 This will retrieve the files archived in the file directory.cpio and
119place them in the present directory. The `-i' option extracts the
120archive and the `-v' shows the file names as they are extracted. If
121you are dealing with an archived directory tree, you need to use the
122`-d' option to create directories as necessary, something like:
123
124 % cpio -idv < tree.cpio
125
126 This will take the contents of the archive tree.cpio and extract it
127to the current directory. If you try to extract the files on top of
128files of the same name that already exist (and have the same or later
129modification time) cpio will not extract the file unless told to do so
130by the -u option. *Note Copy-in mode::.
131
132 In copy-pass mode, cpio copies files from one directory tree to
133another, combining the copy-out and copy-in steps without actually
134using an archive. It reads the list of files to copy from the standard
135input; the directory into which it will copy them is given as a
136non-option argument. *Note Copy-pass mode::.
137
138 % find . -depth -print0 | cpio --null -pvd new-dir
139
140 The example shows copying the files of the present directory, and
141sub-directories to a new directory called new-dir. Some new options are
142the `-print0' available with GNU find, combined with the `--null'
143option of cpio. These two options act together to send file names
144between find and cpio, even if special characters are embedded in the
145file names. Another is `-p', which tells cpio to pass the files it
146finds to the directory `new-dir'.
147
148
149File: cpio.info, Node: Invoking `cpio', Next: Media, Prev: Tutorial, Up: Top
150
1513 Invoking cpio
152***************
153
154* Menu:
155
156* Copy-out mode::
157* Copy-in mode::
158* Copy-pass mode::
159* Options::
160
161
162File: cpio.info, Node: Copy-out mode, Next: Copy-in mode, Prev: Invoking `cpio', Up: Invoking `cpio'
163
1643.1 Copy-out mode
165=================
166
167In copy-out mode, cpio copies files into an archive. It reads a list
168of filenames, one per line, on the standard input, and writes the
169archive onto the standard output. A typical way to generate the list
170of filenames is with the find command; you should give find the -depth
171option to minimize problems with permissions on directories that are
172unreadable. *Note Options::.
173
174 cpio {-o|--create} [-0acvABLV] [-C bytes] [-H format]
175 [-M message] [-O [[user@]host:]archive] [-F [[user@]host:]archive]
176 [--file=[[user@]host:]archive] [--format=format]
177 [--message=message][--null] [--reset-access-time] [--verbose]
178 [--dot] [--append] [--block-size=blocks] [--dereference]
179 [--io-size=bytes] [--rsh-command=command] [--help] [--version]
180 < name-list [> archive]
181
182
183File: cpio.info, Node: Copy-in mode, Next: Copy-pass mode, Prev: Copy-out mode, Up: Invoking `cpio'
184
1853.2 Copy-in mode
186================
187
188In copy-in mode, cpio copies files out of an archive or lists the
189archive contents. It reads the archive from the standard input. Any
190non-option command line arguments are shell globbing patterns; only
191files in the archive whose names match one or more of those patterns are
192copied from the archive. Unlike in the shell, an initial `.' in a
193filename does match a wildcard at the start of a pattern, and a `/' in a
194filename can match wildcards. If no patterns are given, all files are
195extracted. *Note Options::.
196
197 cpio {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file]
198 [-H format] [-M message] [-R [user][:.][group]]
199 [-I [[user@]host:]archive] [-F [[user@]host:]archive]
200 [--file=[[user@]host:]archive] [--make-directories]
201 [--nonmatching] [--preserve-modification-time]
202 [--numeric-uid-gid] [--rename] [--list] [--swap-bytes] [--swap]
203 [--dot] [--unconditional] [--verbose] [--block-size=blocks]
204 [--swap-halfwords] [--io-size=bytes] [--pattern-file=file]
205 [--format=format] [--owner=[user][:.][group]]
206 [--no-preserve-owner] [--message=message] [--help] [--version]
207 [-no-absolute-filenames] [--sparse] [-only-verify-crc] [-quiet]
208 [--rsh-command=command] [pattern...] [< archive]
209
210
211File: cpio.info, Node: Copy-pass mode, Next: Options, Prev: Copy-in mode, Up: Invoking `cpio'
212
2133.3 Copy-pass mode
214==================
215
216In copy-pass mode, cpio copies files from one directory tree to
217another, combining the copy-out and copy-in steps without actually
218using an archive. It reads the list of files to copy from the standard
219input; the directory into which it will copy them is given as a
220non-option argument. *Note Options::.
221
222 cpio {-p|--pass-through} [-0adlmuvLV] [-R [user][:.][group]]
223 [--null] [--reset-access-time] [--make-directories] [--link]
224 [--preserve-modification-time] [--unconditional] [--verbose]
225 [--dot] [--dereference] [--owner=[user][:.][group]] [--sparse]
226 [--no-preserve-owner] [--help] [--version] destination-directory
227 < name-list
228
229
230File: cpio.info, Node: Options, Prev: Copy-pass mode, Up: Invoking `cpio'
231
2323.4 Options
233===========
234
235`-0, --null'
236 Read a list of filenames terminated by a null character, instead
237 of a newline, so that files whose names contain newlines can be
238 archived. GNU find is one way to produce a list of
239 null-terminated filenames. This option may be used in copy-out
240 and copy-pass modes.
241
242`-a, --reset-access-time'
243 Reset the access times of files after reading them, so that it
244 does not look like they have just been read.
245
246`-A, --append'
247 Append to an existing archive. Only works in copy-out mode. The
248 archive must be a disk file specified with the -O or -F (-file)
249 option.
250
251`-b, --swap'
252 Swap both halfwords of words and bytes of halfwords in the data.
253 Equivalent to -sS. This option may be used in copy-in mode. Use
254 this option to convert 32-bit integers between big-endian and
255 little-endian machines.
256
257`-B'
258 Set the I/O block size to 5120 bytes. Initially the block size is
259 512 bytes.
260
261`--block-size=BLOCK-SIZE'
262 Set the I/O block size to BLOCK-SIZE * 512 bytes.
263
264`-c'
265 Use the old portable (ASCII) archive format.
266
267`-C IO-SIZE, --io-size=IO-SIZE'
268 Set the I/O block size to IO-SIZE bytes.
269
270`-d, --make-directories'
271 Create leading directories where needed.
272
273`-E FILE, --pattern-file=FILE'
274 Read additional patterns specifying filenames to extract or list
275 from FILE. The lines of FILE are treated as if they had been
276 non-option arguments to cpio. This option is used in copy-in mode,
277
278`-f, --nonmatching'
279 Only copy files that do not match any of the given patterns.
280
281`-F, --file=archive'
282 Archive filename to use instead of standard input or output. To
283 use a tape drive on another machine as the archive, use a filename
284 that starts with `HOSTNAME:'. The hostname can be preceded by a
285 username and an `@' to access the remote tape drive as that user,
286 if you have permission to do so (typically an entry in that user's
287 `~/.rhosts' file).
288
289`--force-local'
290 With -F, -I, or -O, take the archive file name to be a local file
291 even if it contains a colon, which would ordinarily indicate a
292 remote host name.
293
294`-H FORMAT, --format=FORMAT'
295 Use archive format FORMAT. The valid formats are listed below;
296 the same names are also recognized in all-caps. The default in
297 copy-in mode is to automatically detect the archive format, and in
298 copy-out mode is `bin'.
299
300 `bin'
301 The obsolete binary format.
302
303 `odc'
304 The old (POSIX.1) portable format.
305
306 `newc'
307 The new (SVR4) portable format, which supports file systems
308 having more than 65536 i-nodes.
309
310 `crc'
311 The new (SVR4) portable format with a checksum added.
312
313 `tar'
314 The old tar format.
315
316 `ustar'
317 The POSIX.1 tar format. Also recognizes GNU tar archives,
318 which are similar but not identical.
319
320 `hpbin'
321 The obsolete binary format used by HPUX's cpio (which stores
322 device files differently).
323
324 `hpodc'
325 The portable format used by HPUX's cpio (which stores device
326 files differently).
327
328`-i, --extract'
329 Run in copy-in mode. *Note Copy-in mode::.
330
331`-I archive'
332 Archive filename to use instead of standard input. To use a tape
333 drive on another machine as the archive, use a filename that
334 starts with `HOSTNAME:'. The hostname can be preceded by a
335 username and an `@' to access the remote tape drive as that user,
336 if you have permission to do so (typically an entry in that user's
337 `~/.rhosts' file).
338
339`-k'
340 Ignored; for compatibility with other versions of cpio.
341
342`-l, --link'
343 Link files instead of copying them, when possible.
344
345`-L, --dereference'
346 Copy the file that a symbolic link points to, rather than the
347 symbolic link itself.
348
349`-m, --preserve-modification-time'
350 Retain previous file modification times when creating files.
351
352`-M MESSAGE, --message=MESSAGE'
353 Print MESSAGE when the end of a volume of the backup media (such
354 as a tape or a floppy disk) is reached, to prompt the user to
355 insert a new volume. If MESSAGE contains the string "%d", it is
356 replaced by the current volume number (starting at 1).
357
358`-n, --numeric-uid-gid'
359 Show numeric UID and GID instead of translating them into names
360 when using the `--verbose option'.
361
362`--no-absolute-filenames'
363 Create all files relative to the current directory in copy-in
364 mode, even if they have an absolute file name in the archive.
365
366`--no-preserve-owner'
367 Do not change the ownership of the files; leave them owned by the
368 user extracting them. This is the default for non-root users, so
369 that users on System V don't inadvertantly give away files. This
370 option can be used in copy-in mode and copy-pass mode
371
372`-o, --create'
373 Run in copy-out mode. *Note Copy-out mode::.
374
375`-O archive'
376 Archive filename to use instead of standard output. To use a tape
377 drive on another machine as the archive, use a filename that
378 starts with `HOSTNAME:'. The hostname can be preceded by a
379 username and an `@' to access the remote tape drive as that user,
380 if you have permission to do so (typically an entry in that user's
381 `~/.rhosts' file).
382
383`--only-verify-crc'
384 Verify the CRC's of each file in the archive, when reading a CRC
385 format archive. Don't actually extract the files.
386
387`-p, --pass-through'
388 Run in copy-pass mode. *Note Copy-pass mode::.
389
390`--quiet'
391 Do not print the number of blocks copied.
392
393`-r, --rename'
394 Interactively rename files.
395
396`-R [user][:.][group], --owner [user][:.][group]'
397 Set the ownership of all files created to the specified user and/or
398 group in copy-out and copy-pass modes. Either the user, the
399 group, or both, must be present. If the group is omitted but the
400 ":" or "." separator is given, use the given user's login group.
401 Only the super-user can change files' ownership.
402
403`--rsh-command=COMMAND'
404 Notifies cpio that is should use COMMAND to communicate with remote
405 devices.
406
407`-s, --swap-bytes'
408 Swap the bytes of each halfword (pair of bytes) in the files.This
409 option can be used in copy-in mode.
410
411`-S, --swap-halfwords'
412 Swap the halfwords of each word (4 bytes) in the files. This
413 option may be used in copy-in mode.
414
415`--sparse'
416 Write files with large blocks of zeros as sparse files. This
417 option is used in copy-in and copy-pass modes.
418
419`-t, --list'
420 Print a table of contents of the input.
421
422`-u, --unconditional'
423 Replace all files, without asking whether to replace existing
424 newer files with older files.
425
426`-v, --verbose'
427 List the files processed, or with `-t', give an `ls -l' style
428 table of contents listing. In a verbose table of contents of a
429 ustar archive, user and group names in the archive that do not
430 exist on the local system are replaced by the names that
431 correspond locally to the numeric UID and GID stored in the
432 archive.
433
434`-V --dot'
435 Print a `.' for each file processed.
436
437`--version'
438 Print the cpio program version number and exit.
439
440
441File: cpio.info, Node: Media, Next: Concept Index, Prev: Invoking `cpio', Up: Top
442
4434 Magnetic Media
444****************
445
446Archives are usually written on removable media-tape cartridges, mag
447tapes, or floppy disks.
448
449 The amount of data a tape or disk holds depends not only on its size,
450but also on how it is formatted. A 2400 foot long reel of mag tape
451holds 40 megabytes of data when formated at 1600 bits per inch. The
452physically smaller EXABYTE tape cartridge holds 2.3 gigabytes.
453
454 Magnetic media are re-usable-once the archive on a tape is no longer
455needed, the archive can be erased and the tape or disk used over. Media
456quality does deteriorate with use, however. Most tapes or disks should
457be disgarded when they begin to produce data errors.
458
459 Magnetic media are written and erased using magnetic fields, and
460should be protected from such fields to avoid damage to stored data.
461Sticking a floppy disk to a filing cabinet using a magnet is probably
462not a good idea.
463
464
465File: cpio.info, Node: Concept Index, Prev: Media, Up: Top
466
467Concept Index
468*************
469
470[index]
471* Menu:
472
473* command line options: Invoking `cpio'. (line 6)
474* copying directory structures: Tutorial. (line 6)
475* creating a cpio archive: Tutorial. (line 6)
476* extracting a cpio archive: Tutorial. (line 6)
477* invoking cpio: Invoking `cpio'. (line 6)
478* magnetic media: Media. (line 6)
479* passing directory structures: Tutorial. (line 6)
480
481
482
483Tag Table:
484Node: Top1037
485Node: Introduction1756
486Node: Tutorial2472
487Node: Invoking `cpio'6145
488Node: Copy-out mode6338
489Node: Copy-in mode7272
490Node: Copy-pass mode8658
491Node: Options9459
492Node: Media16735
493Node: Concept Index17722
494
495End Tag Table
Note: See TracBrowser for help on using the repository browser.