- Test m_pkthdr.fw_flags against DUMMYNET_MBUF_TAGGED before trying to locate
[dragonfly/netmp.git] / contrib / cpio / cpio.texi
blob6b0fd45c519f6c38d297c9c1733664f2b647b062
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename cpio.info
4 @settitle cpio
5 @setchapternewpage off
6 @set VERSION GNU cpio 2.4
7 @set RELEASEDATE November 1995
8 @c %**end of header
10 @ifinfo
11 @format
12 START-INFO-DIR-ENTRY
13 * cpio: (cpio).                 Making tape (or disk) archives.
14 END-INFO-DIR-ENTRY
15 @end format
16 @end ifinfo
18 @ifinfo
19 This file documents @value{VERSION}.
21 Copyright (C) 1995 Free Software Foundation, Inc.
23 Permission is granted to make and distribute verbatim copies of
24 this manual provided the copyright notice and this permission notice
25 are preserved on all copies.
27 @ignore
28 Permission is granted to process this file through TeX and print the
29 results, provided the printed document carries copying permission
30 notice identical to this one except for the removal of this paragraph
33 @end ignore
34 Permission is granted to copy and distribute modified versions of this
35 manual under the conditions for verbatim copying, provided that the entire
36 resulting derived work is distributed under the terms of a permission
37 notice identical to this one.
39 Permission is granted to copy and distribute translations of this manual
40 into another language, under the above conditions for modified versions,
41 except that this permission notice may be stated in a translation approved
42 by the Foundation.
43 @end ifinfo
46 @titlepage
47 @title GNU CPIO
48 @subtitle @value{VERSION} @value{RELEASEDATE}
49 @author by Robert Carleton
50 @c copyright page
51 @page
52 @vskip 0pt plus 1filll
53 Copyright @copyright{} 1995 Free Software Foundation, Inc.
54 @sp 2
55 This is the first edition of the GNU cpio documentation,@*
56 and is consistent with @value{VERSION}.@*
57 @sp 2
58 Published by the Free Software Foundation @*
59 59 Temple Place - Suite 330, @*
60 Boston, MA 02111-1307, USA @*
62 Permission is granted to make and distribute verbatim copies of
63 this manual provided the copyright notice and this permission notice
64 are preserved on all copies.
66 Permission is granted to copy and distribute modified versions of this
67 manual under the conditions for verbatim copying, provided that the entire
68 resulting derived work is distributed under the terms of a permission
69 notice identical to this one.
71 Permission is granted to copy and distribute translations of this manual
72 into another language, under the above conditions for modified versions,
73 except that this permission notice may be stated in a translation
74 approved by the Free Software Foundation.
75 @end titlepage
77 @ifinfo
78 @node Top, Introduction, (dir), (dir)
79 @comment  node-name,  next,  previous,  up
80 @top
82 GNU cpio is a tool for creating and extracting archives, or copying
83 files from one place to another.  It handles a number of cpio formats as
84 well as reading and writing tar files.  This is the first edition of the 
85 GNU cpio documentation and is consistant with @value{VERSION}.
87 @menu
88 * Introduction::                
89 * Tutorial::                    Getting started.
90 * Invoking `cpio'::             How to invoke `cpio'.
91 * Media::                       Using tapes and other archive media.
92 * Concept Index::               Concept index.
94  --- The Detailed Node Listing ---
96 Invoking cpio
98 * Copy-out mode::               
99 * Copy-in mode::                
100 * Copy-pass mode::              
101 * Options::                     
102 @end menu
104 @end ifinfo
106 @node Introduction, Tutorial, Top, Top
107 @comment  node-name,  next,  previous,  up
108 @chapter Introduction
110 GNU cpio copies files into or out of a cpio or tar archive, The archive
111 can be another file on the disk, a magnetic tape, or a pipe.
113 GNU cpio supports the following archive formats: binary, old ASCII, new
114 ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar.  The
115 tar format is provided for compatability with the tar program. By
116 default, cpio creates binary format archives, for compatibility with
117 older cpio programs.  When extracting from archives, cpio automatically
118 recognizes which kind of archive it is reading and can read archives
119 created on machines with a different byte-order.
121 @node Tutorial, Invoking `cpio', Introduction, Top
122 @comment  node-name,  next,  previous,  up
123 @chapter Tutorial
124 @cindex creating a cpio archive
125 @cindex extracting a cpio archive
126 @cindex copying directory structures
127 @cindex passing directory structures
130 GNU cpio performs three primary functions.  Copying files to an
131 archive, Extracting files from an archive, and passing files to another
132 directory tree.  An archive can be a file on disk, one or more floppy
133 disks, or one or more tapes.
135 When creating an archive, cpio takes the list of files to be processed
136 from the standard input, and then sends the archive to the standard
137 output, or to the device defined by the @samp{-F} option.
138 @xref{Copy-out mode}.  Usually find or ls is used to provide this list
139 to the standard input.  In the following example you can see the
140 possibilities for archiving the contents of a single directory.
143 @example
144 @cartouche
145 % ls | cpio -ov > directory.cpio
146 @end cartouche
147 @end example
149 The @samp{-o} option creates the archive, and the @samp{-v} option
150 prints the names of the files archived as they are added.  Notice that
151 the options can be put together after a single @samp{-} or can be placed
152 separately on the command line.  The @samp{>} redirects the cpio output
153 to the file @samp{directory.cpio}.
156 If you wanted to archive an entire directory tree, the find command can
157 provide the file list to cpio:
160 @example
161 @cartouche
162 % find . -print -depth | cpio -ov > tree.cpio
163 @end cartouche
164 @end example
167 This will take all the files in the current directory, the directories
168 below and place them in the archive tree.cpio.  Again the @samp{-o}
169 creates an archive, and the @samp{-v} option shows you the name of the
170 files as they are archived.  @xref{Copy-out mode}.  Using the `.' in the
171 find statement will give you more flexibility when doing restores, as it
172 will save file names with a relative path vice a hard wired, absolute
173 path.  The @samp{-depth} option forces @samp{find} to print of the
174 entries in a directory before printing the directory itself.  This
175 limits the effects of restrictive directory permissions by printing the
176 directory entries in a directory before the directory name itself.
181 Extracting an archive requires a bit more thought because cpio will not
182 create directories by default.  Another characteristic, is it will not
183 overwrite existing files unless you tell it to.
186 @example
187 @cartouche
188 % cpio -iv < directory.cpio
189 @end cartouche
190 @end example
192 This will retrieve the files archived in the file directory.cpio and
193 place them in the present directory.  The @samp{-i} option extracts the
194 archive and the @samp{-v} shows the file names as they are extracted.
195 If you are dealing with an archived directory tree, you need to use the
196 @samp{-d} option to create directories as necessary, something like:
198 @example
199 @cartouche
200 % cpio -idv < tree.cpio
201 @end cartouche
202 @end example
204 This will take the contents of the archive tree.cpio and extract it to
205 the current directory.  If you try to extract the files on top of files
206 of the same name that already exist (and have the same or later
207 modification time) cpio will not extract the file unless told to do so
208 by the -u option.  @xref{Copy-in mode}.
211 In copy-pass mode, cpio copies files from one directory tree to another,
212 combining the copy-out and copy-in steps without actually using an
213 archive.  It reads the list of files to copy from the standard input;
214 the directory into which it will copy them is given as a non-option
215 argument.  @xref{Copy-pass mode}.
217 @example
218 @cartouche
219 % find . -depth -print0 | cpio --null -pvd new-dir
220 @end cartouche
221 @end example
224 The example shows copying the files of the present directory, and
225 sub-directories to a new directory called new-dir.  Some new options are
226 the @samp{-print0} available with GNU find, combined with the
227 @samp{--null} option of cpio.  These two options act together to send
228 file names between find and cpio, even if special characters are
229 embedded in the file names.  Another is @samp{-p}, which tells cpio to
230 pass the files it finds to the directory @samp{new-dir}.
232 @node Invoking `cpio', Media, Tutorial, Top
233 @comment  node-name,  next,  previous,  up
234 @chapter Invoking cpio
235 @cindex invoking cpio
236 @cindex command line options
238 @menu
239 * Copy-out mode::               
240 * Copy-in mode::                
241 * Copy-pass mode::              
242 * Options::                     
243 @end menu
245 @node Copy-out mode, Copy-in mode, Invoking `cpio', Invoking `cpio'
246 @comment  node-name,  next,  previous,  up
247 @section Copy-out mode
249 In copy-out mode, cpio copies files into an archive.  It reads a list
250 of filenames, one per line, on the standard input, and writes the
251 archive onto the standard output.  A typical way to generate the list
252 of filenames is with the find command; you should give find the -depth
253 option to minimize problems with permissions on directories that are
254 unreadable.
255 @xref{Options}.
257 @example
258 cpio @{-o|--create@} [-0acvABLV] [-C bytes] [-H format]
259 [-M message] [-O [[user@@]host:]archive] [-F [[user@@]host:]archive]
260 [--file=[[user@@]host:]archive] [--format=format] [--sparse]
261 [--message=message][--null] [--reset-access-time] [--verbose]
262 [--dot] [--append] [--block-size=blocks] [--dereference]
263 [--io-size=bytes] [--help] [--version] < name-list [> archive]
264 @end example
266 @node Copy-in mode, Copy-pass mode, Copy-out mode, Invoking `cpio'
267 @comment  node-name,  next,  previous,  up
268 @section Copy-in mode
270 In copy-in mode, cpio copies files out of an archive or lists the
271 archive contents.  It reads the archive from the standard input.  Any
272 non-option command line arguments are shell globbing patterns; only
273 files in the archive whose names match one or more of those patterns are
274 copied from the archive.  Unlike in the shell, an initial `.' in a
275 filename does match a wildcard at the start of a pattern, and a `/' in a
276 filename can match wildcards.  If no patterns are given, all files are
277 extracted.  @xref{Options}.
279 @example
280 cpio @{-i|--extract@} [-bcdfmnrtsuvBSV] [-C bytes] [-E file]
281 [-H format] [-M message] [-R [user][:.][group]]
282 [-I [[user@@]host:]archive] [-F [[user@@]host:]archive]
283 [--file=[[user@@]host:]archive] [--make-directories]
284 [--nonmatching] [--preserve-modification-time]
285 [--numeric-uid-gid] [--rename] [--list] [--swap-bytes] [--swap]
286 [--dot] [--unconditional] [--verbose] [--block-size=blocks]
287 [--swap-halfwords] [--io-size=bytes] [--pattern-file=file]
288 [--format=format] [--owner=[user][:.][group]]
289 [--no- preserve-owner] [--message=message] [--help] [--version]
290 [-no-abosolute-filenames] [-only-verify-crc] [-quiet]
291 [pattern...] [< archive]
292 @end example
294 @node Copy-pass mode, Options, Copy-in mode, Invoking `cpio'
295 @comment  node-name,  next,  previous,  up
296 @section Copy-pass mode
298 In copy-pass mode, cpio copies files from one directory tree to
299 another, combining the copy-out and copy-in steps without actually
300 using an archive.  It reads the list of files to copy from the
301 standard input; the directory into which it will copy them is given as
302 a non-option argument.
303 @xref{Options}.
305 @example
306 cpio @{-p|--pass-through@} [-0adlmuvLV] [-R [user][:.][group]]
307 [--null] [--reset-access-time] [--make-directories] [--link]
308 [--preserve-modification-time] [--unconditional] [--verbose]
309 [--dot] [--dereference] [--owner=[user][:.][group]] [--sparse]
310 [--no-preserve-owner] [--help] [--version] destination-directory
311 < name-list
312 @end example
316 @node Options,  , Copy-pass mode, Invoking `cpio'
317 @comment  node-name,  next,  previous,  up
318 @section Options
321 @table @code
324 @item -0, --null
325 Read a list of filenames terminated by a null character, instead of a
326 newline, so that files whose names contain newlines can be archived.
327 GNU find is one way to produce a list of null-terminated filenames.
328 This option may be used in copy-out and copy-pass modes.
330 @item -a, --reset-access-time
331 Reset the access times of files after reading them, so
332 that it does not look like they have just been read.
334 @item -A, --append
335 Append to an existing archive.  Only works in copy-out
336 mode.  The archive must be a disk file specified with
337 the -O or -F (--file) option.
339 @item -b, --swap
340 Swap both halfwords of words and bytes of halfwords in the data.
341 Equivalent to -sS.  This option may be used in copy-in mode.  Use this
342 option to convert 32-bit integers between big-endian and little-endian
343 machines.
345 @item -B   
346 Set the I/O block size to 5120 bytes.  Initially the
347 block size is 512 bytes.
349 @item --block-size=BLOCK-SIZE
350 Set the I/O block size to BLOCK-SIZE * 512 bytes.
352 @item -c
353 Use the old portable (ASCII) archive format.
355 @item -C IO-SIZE, --io-size=IO-SIZE
356 Set the I/O block size to IO-SIZE bytes.
358 @item -d, --make-directories
359 Create leading directories where needed.
361 @item -E FILE, --pattern-file=FILE
362 Read additional patterns specifying filenames to extract or list from
363 FILE.  The lines of FILE are treated as if they had been non-option
364 arguments to cpio.  This option is used in copy-in mode,
366 @item -f, --nonmatching
367 Only copy files that do not match any of the given
368 patterns.
370 @item -F, --file=archive
371 Archive filename to use instead of standard input or output.  To use a
372 tape drive on another machine as the archive, use a filename that starts
373 with `HOSTNAME:'.  The hostname can be preceded by a username and an
374 `@@' to access the remote tape drive as that user, if you have
375 permission to do so (typically an entry in that user's `~/.rhosts'
376 file).
378 @item --force-local
379 With -F, -I, or -O, take the archive file name to be a
380 local file even if it contains a colon, which would
381 ordinarily indicate a remote host name.
383 @item -H FORMAT, --format=FORMAT
384 Use archive format FORMAT.  The valid formats are listed below; the same
385 names are also recognized in all-caps.  The default in copy-in mode is
386 to automatically detect the archive format, and in copy-out mode is
387 @samp{bin}.
389 @table @samp
390 @item bin  
391 The obsolete binary format.
393 @item odc
394 The old (POSIX.1) portable format.
396 @item newc
397 The new (SVR4) portable format, which supports file systems having more
398 than 65536 i-nodes.
400 @item crc
401 The new (SVR4) portable format with a checksum added.
403 @item tar
404 The old tar format.
406 @item ustar
407 The POSIX.1 tar format.  Also recognizes GNU tar archives, which are
408 similar but not identical.
410 @item hpbin
411 The obsolete binary format used by HPUX's cpio (which stores device
412 files differently).
414 @item hpodc
415 The portable format used by HPUX's cpio (which stores device files
416 differently).
417 @end table
419 @item -i, --extract
420 Run in copy-in mode.
421 @xref{Copy-in mode}.
423 @item -I archive
424 Archive filename to use instead of standard input.  To use a tape drive
425 on another machine as the archive, use a filename that starts with
426 `HOSTNAME:'.  The hostname can be preceded by a username and an `@@' to
427 access the remote tape drive as that user, if you have permission to do
428 so (typically an entry in that user's `~/.rhosts' file).
430 @item -k
431 Ignored; for compatibility with other versions of cpio.
433 @item -l, --link
434 Link files instead of copying them, when possible.
436 @item -L, --dereference
437 Copy the file that a symbolic link points to, rather than the symbolic
438 link itself.
440 @item -m, --preserve-modification-time
441 Retain previous file modification times when creating files.
443 @item -M MESSAGE, --message=MESSAGE
444 Print MESSAGE when the end of a volume of the backup media (such as a
445 tape or a floppy disk) is reached, to prompt the user to insert a new
446 volume.  If MESSAGE contains the string "%d", it is replaced by the
447 current volume number (starting at 1).
449 @item -n, --numeric-uid-gid
450 Show numeric UID and GID instead of translating them into names when using the
451 @samp{--verbose option}.
453 @item --no-absolute-filenames
454 Create all files relative to the current directory in copy-in mode, even
455 if they have an absolute file name in the archive.
457 @item --no-preserve-owner
458 Do not change the ownership of the files; leave them owned by the user
459 extracting them.  This is the default for non-root users, so that users
460 on System V don't inadvertantly give away files.  This option can be
461 used in copy-in mode and copy-pass mode
463 @item -o, --create
464 Run in copy-out mode.
465 @xref{Copy-out mode}.
467 @item -O archive
468 Archive filename to use instead of standard output.  To use a tape drive
469 on another machine as the archive, use a filename that starts with
470 `HOSTNAME:'.  The hostname can be preceded by a username and an `@@' to
471 access the remote tape drive as that user, if you have permission to do
472 so (typically an entry in that user's `~/.rhosts' file).
474 @item --only-verify-crc
475 Verify the CRC's of each file in the archive, when reading a CRC format
476 archive. Don't actually extract the files.
478 @item -p, --pass-through
479 Run in copy-pass mode.
480 @xref{Copy-pass mode}.
482 @item --quiet
483 Do not print the number of blocks copied.
485 @item -r, --rename
486 Interactively rename files.
488 @item -R [user][:.][group], --owner [user][:.][group]
489 Set the ownership of all files created to the specified user and/or
490 group in copy-out and copy-pass modes.  Either the user, the group, or
491 both, must be present.  If the group is omitted but the ":" or "."
492 separator is given, use the given user's login group.  Only the
493 super-user can change files' ownership.
495 @item -s, --swap-bytes
496 Swap the bytes of each halfword (pair of bytes) in the files.This option
497 can be used in copy-in mode.
499 @item -S, --swap-halfwords
500 Swap the halfwords of each word (4 bytes) in the files.  This option may
501 be used in copy-in mode.
503 @item --sparse
504 Write files with large blocks of zeros as sparse files.  This option is
505 used in copy-out and copy-pass modes.
507 @item -t, --list
508 Print a table of contents of the input.
510 @item -u, --unconditional
511 Replace all files, without asking whether to replace
512 existing newer files with older files.
514 @item -v, --verbose
515 List the files processed, or with @samp{-t}, give an @samp{ls -l} style
516 table of contents listing.  In a verbose table of contents of a ustar
517 archive, user and group names in the archive that do not exist on the
518 local system are replaced by the names that correspond locally to the
519 numeric UID and GID stored in the archive.
521 @item -V --dot
522 Print a @kbd{.} for each file processed.
524 @item --version
525 Print the cpio program version number and exit.
526 @end table
529 @node Media, Concept Index, Invoking `cpio', Top
530 @comment  node-name,  next,  previous,  up
531 @chapter Magnetic Media
532 @cindex magnetic media
534 Archives are usually written on removable media--tape cartridges, mag
535 tapes, or floppy disks.
537 The amount of data a tape or disk holds depends not only on its size,
538 but also on how it is formatted.  A 2400 foot long reel of mag tape
539 holds 40 megabytes of data when formated at 1600 bits per inch.  The
540 physically smaller EXABYTE tape cartridge holds 2.3 gigabytes.
542 Magnetic media are re-usable--once the archive on a tape is no longer
543 needed, the archive can be erased and the tape or disk used over. Media
544 quality does deteriorate with use, however.  Most tapes or disks should
545 be disgarded when they begin to produce data errors.
547 Magnetic media are written and erased using magnetic fields, and should
548 be protected from such fields to avoid damage to stored data.  Sticking
549 a floppy disk to a filing cabinet using a magnet is probably not a good
550 idea.
553 @node Concept Index,  , Media, Top
554 @comment  node-name,  next,  previous,  up
555 @unnumbered Concept Index
556 @printindex cp
557 @contents
558 @bye