]> Dogcows Code - chaz/tar/blob - doc/tar.texi
*** empty log message ***
[chaz/tar] / doc / tar.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename tar.info
4 @settitle The Tar Manual: DRAFT
5 @setchapternewpage odd
6 @c %**end of header
7
8 @c Note: the edition number and date is listed in *two* places; please update.
9 @c subtitle and top node; search for !!set
10
11 @c Search for comments marked with !! or <<< (or >>>)
12
13 @c <<< CONVENTIONS: this manual refers to "ordinary files" , "directory
14 files" (or "directories"), "archive files", "archive members", and
15 various I/O devices (which have names and file names).>>>
16
17 @c <<< it's "file name" (not filename) unless we are talking about an
18 argument, ie. @var{file-name}. also, you "use" a "file-name argument"
19 to "specify" a "file".>>>
20
21 @c <<< @code{tar} is always lower case, in bold. >>>
22
23 @c <<< it's "operations of tar", "options to tar" also, it's " @samp{tar
24 --foo}" or "the @samp{--foo} operation". MIB doesn't like using
25 operations and options as separate concepts. I disagree --- would be a
26 mess to explain otherwise
27
28 @c <<< (don't forget to comment these out in final draft) -ringo
29
30 @c <<< please dont' change this without sending me e-mail. some things
31 @c are in progress or waiting to be edited in hardcopy. -ringo
32 @c smallbook
33
34 @iftex
35 @c finalout
36 @end iftex
37
38 @ifinfo
39 This file documents @code{tar}, a utility used to store, backup, and
40 transport files.
41
42 Copyright (C) 1992 Free Software Foundation, Inc. DRAFT!
43 @c Need to put distribution information here when ready.
44 @end ifinfo
45
46 @c !!set edition number and date here
47 @titlepage
48 @title @code{tar}
49 @subtitle The GNU Tape Archiver
50 @subtitle Edition 0.01, for @code{tar} Version 1.10
51 @subtitle @today{}
52 @c remove preceding today line when ready
53 @sp 1
54 @subtitle DRAFT
55 @c subtitle insert month here when ready
56
57 @author Amy Gorin, Michael I. Bushnell, and Jay Fenlason
58 @c <<<best to have hack read this over and see if anything is left he
59 @c wrote. I don't think so. -ringo>>>>
60
61 @page
62 @vskip 0pt plus 1filll
63 Copyright @copyright{} 1992 Free Software Foundation, Inc.
64
65 @sp 2
66 This draft is not yet ready for distribution.
67 @end titlepage
68
69 @ifinfo
70 @node Top, Introduction, (dir), (dir)
71 @top @code{tar}
72
73 This file documents @code{tar}, a utility used to store, backup, and
74 transport files.
75
76 @c !!set edition number and date here
77 This is DRAFT Edition 0.01 of the @code{tar} documentation, @today{}, for @code{tar}
78 version 1.12.
79 @end ifinfo
80
81 @c <<< The menus need to be gone over, and node names fixed.
82 @menu
83 * Introduction:: @code{tar}: The GNU Tape Archiver
84 * Invoking @code{tar}:: How to invoke @code{tar}
85 * Tutorial:: Getting started
86 * Wizardry:: Some More Advanced Uses for @code{tar}
87 * Archive Structure:: The structure of an archive
88 * Reading and Writing:: Reading and writing archives
89 * Insuring Accuracy:: How to insure the accuracy of an archive
90 * Selecting Archive Members:: How to select archive members
91 * User Interaction:: How @code{tar} interacts with people.
92 * Backups and Restoration:: How to restore files and perform backups
93 * Media:: Using tapes and other archive media
94 * Quick Reference:: A quick reference guide to
95 @code{tar} operations and options
96 * Data Format Details:: Details of the archive data format
97 * Concept Index:: Concept Index
98 @end menu
99
100 @node Introduction, Invoking @code{tar}, Top, Top
101 @chapter @code{tar}: The GNU Tape Archiver
102
103 You can use @code{tar} to create an @dfn{archive}---a single file
104 which contains other files' contents as well as a listing of those
105 files' characteristics. You can also use @code{tar} to read, add to,
106 or manipulate already existing archives. Because an archive created
107 by @code{tar} is capable of preserving file information and directory
108 structure, @code{tar} is ideal for performing full and incremental
109 backups, as well as for transferring groups of files between disks and
110 over networks.
111
112 The name @code{tar} comes from the words ``Tape ARchiver'', but
113 @code{tar} can actually process archives wherever they are stored; on
114 tapes and disk files, for example. In addition, tar can read archives
115 from standard input or write them to standard output. (This is often
116 useful if redirected another program with a pipe.)
117
118 @c <<< this menu will conflict with menu above in info mode. -ringo
119 @menu
120 * Invoking @code{tar}:: How to invoke @code{tar} and specify arguments.
121 * Tutorial:: An introduction to @code{tar}.
122 * Operations:: What you can use @code{tar} to do.
123 * Options:: How to change the way @code{tar} behaves.
124 * Problems:: Common problems with @code{tar}.
125 @end menu
126
127 @node Invoking @code{tar}, Tutorial, Introduction, Top
128 @chapter How To Invoke @code{tar}
129
130 The usual way to invoke tar is
131
132 @example
133 @code{tar} @var{options}... [@var{file-names}...]
134 @end example
135
136 All the options start with @samp{-}. The arguments which do not start
137 with @samp{-} are taken to be file-name arguments. (But
138 @xref{Argument Form}.) You can actually type in arguments in any
139 order. In this manual the options always precede the file-name
140 arguments, to make examples easier to understand.
141
142 @menu
143 * Option Form:: The Forms of Arguments
144 * Argument Functions:: The Functions of Arguments
145 * Old Syntax for Commands:: An Old, but Still Supported, Syntax
146 for @code{tar} Commands
147 @end menu
148
149 @node Option Form, Old Syntax for Commands, Argument Functions, Invoking @code{tar}
150 @section The Forms of Arguments
151
152 Most options of @code{tar} have a single letter form (a single letter
153 preceded by @samp{-}), and at least one mnemonic form (a word or
154 abbreviation preceded by @samp{--}). The forms are absolutely
155 identical in function. For example, you can use either @samp{tar -t}
156 or @samp{tar --list} to list the contents of an archive. In addition,
157 mnemonic names can be given unique abbreviations. For example,
158 @samp{--cre} can be used in place of @samp{--create} because there is
159 no other option which begins with @samp{cre}.
160
161 Some options require an additional argument. Single letter options
162 which require arguments use the immediately following argument. (This
163 is an exception to the rule that @code{tar} arguments which are not
164 options are file-name arguments.) Mnemonic options are separated from
165 their arguments by an @samp{=} sign. For example, to create an an
166 archive file named @file{george}, use either @samp{tar --create
167 --file=george} or @samp{tar --create -f george}. Both
168 @samp{--file=@var{archive-name}} and @samp{-f @var{archive-name}}
169 denote the option to give the archive a non-default name, which in the
170 example is @samp{george}.
171
172 You can mix single letter and mnemonic forms in the same command. You
173 could type the above example as @samp{tar -c --file=george} or
174 @samp{tar --create -f george}. However, @code{tar} operations and
175 options are case sensitive. You would not type the above example as
176 @samp{tar -C --file=george}, because @samp{-C} is an option that
177 causes @code{tar} to change directories, not an operation that creates
178 an archive. In fact, @samp{-C} requires a further argument (the name
179 of the directory which to change to). In this case, tar would think
180 it needs to change to a directory named @samp{--file=george}, and
181 wouldn't interpret @samp{--file-george} as an option at all!
182
183 @node Argument Functions, Argument Form, Invoking @code{tar}, Invoking @code{tar}
184 @section The Functions of Arguments
185
186 You must give exactly one option from the following list to tar. This
187 option specifies the basic operation for tar to perform.
188
189 @itemize
190 @item
191 Add files to an existing archive (@samp{--add-file}, @samp{--append} or
192 @samp{-r})
193
194 @item
195 Compare files in an archive with files in the file system
196 (@samp{--compare}, @samp{--diff} or @samp{-d})
197
198 @item
199 Add archives to another archive (@samp{--add-archive}, @samp{--catenate}
200 or @samp{-A})
201 @c was --concatenate. -ringo
202
203 @item
204 Create a new archive (@samp{--create} or @samp{-c})
205
206 @item
207 Delete files from an archive (@samp{--delete})
208
209 @item
210 Extract files from an archive (@samp{--extract}, @samp{--get} or @samp{-x})
211
212 @item
213 List the files in an archive (@samp{--list} or @samp{-t})
214
215 @item
216 Update an archive by appending newer versions of already stored files
217 (@samp{--update} or @samp{-u})
218 @end itemize
219
220 @xref{Reading and Writing}, for more information about these
221 operations.
222
223 The remaining options to @code{tar} change details of the operation,
224 such as archive format, archive name, or level of user interaction.
225 You can specify more than one option.
226
227 The remaining arguments are file-name arguments. For --add-file and
228 --create these arguments specify the names of files (which must
229 already exist) to place in the archive. For the remaining operation
230 types, the file-name arguments specify archive members to compare,
231 delete, extract, list, or update. When naming archive members, you
232 must give the exact name of the member in the archive. When naming
233 files, the normal file name rules apply.
234
235 If you don't use any file-name arguments, @samp{--add-file},
236 @samp{--update} and @samp{--delete} will do nothing. Naturally,
237 @samp{--create} will make an empty archive if given no file-name
238 arguments. The other operations of @code{tar} will act on defaults.
239
240 Anytime you use a file-name argument to specify a directory file,
241 @code{tar} acts recursively on all the files and directories beneath
242 that directory.
243
244 @node Old Syntax for Commands, , Argument Form, Invoking @code{tar}
245 @section An Old, but Still Supported, Syntax for @code{tar} Commands
246
247 For historical reasons, GNU @code{tar} also accepts a syntax for
248 commands which splits options that require additional arguments into
249 two parts. That syntax is of the form:
250
251 @example
252 @code{tar} @var{option-letters}... [@var{option-arguments}...] [@var{file-names}...]@refill
253 @end example
254
255 @noindent
256 where arguments to the options appear in the same order as the letters
257 to which they correspond, and the operation and all the option letters
258 appear as a single argument, without separating spaces.
259
260 This command syntax is useful because it lets you type the single
261 letter forms of the operation and options as a single argument to
262 @code{tar}, without writing preceding @samp{-}s or inserting spaces
263 between letters. @samp{tar cv} or @samp{tar -cv} are equivalent to
264 @samp{tar -c -v}.
265
266 On the other hand, this old style syntax makes it difficult to match
267 option letters with their corresponding arguments, and is often
268 confusing. In the command @samp{tar cvbf 20 /dev/rmt0}, for example,
269 @samp{20} is the argument for @samp{-b}, @samp{/dev/rmt0} is the
270 argument for @samp{-f}, and @samp{-v} does not have a corresponding
271 argument. The modern syntax---@samp{tar -c -v -b 20 -f
272 /dev/rmt0}---is clearer.
273
274 @node Tutorial, Wizardry, Invoking @code{tar}, Top
275 @chapter Getting Started With @code{tar}
276
277 This chapter guides you through some basic examples of @code{tar}
278 operations. If you already know how to use some other version of tar,
279 then you probably don't need to read this chapter. In the examples,
280 the lines you should type are preceded by a @samp{%}, which is a
281 typical shell prompt.
282
283 @menu
284 * Creating Archives:: Creating Archives
285 * Extracting Files:: Extracting Files from an Archive
286 * Listing Archive Contents:: Listing the Contents of an Archive
287 * Comparing Files:: Comparing Archives with the File System
288 * Adding to Archives:: Adding Files to Existing Archives
289 * Concatenate:: Concatenating Archives
290 * Deleting Files:: Deleting Files From an Archive
291 @end menu
292
293 @node Creating Archives, Listing Archive Contents, Tutorial, Tutorial
294 @section Creating Archives
295
296 To create a new archive, use @code{tar --create} (or @code{tar -c}).
297 You can use options to specify the name and format of the archive (as
298 well as other characteristics), and you can use file-name arguments to
299 specify which files to put in the archive. If you don't use any
300 options or file-name arguments, @code{tar} will use default values.
301 @xref{Creating Example}, for more information about the
302 @samp{--create} operation.
303
304 @menu
305 * Creating Example:: Creating Archives of Files
306 * Subdirectory:: Creating an Archive of a Subdirectory
307 @end menu
308
309 @node Creating Example, Subdirectory, Creating Archives, Creating Archives
310 @subsection Creating Archives of Files
311
312 This example shows you how to create an archive file in the working
313 directory containing other files in the working directory. The three
314 files you archive in this example are called @file{blues},
315 @file{folk}, and @file{jazz}. The archive file is called
316 @file{records}. While the archive in this example is written to the
317 file system, it could also be written to any other device.
318
319 (If you want to follow along with this and future examples, create a
320 directory called @file{practice} containing files called @file{blues},
321 @file{folk} and @file{jazz}. To create the directory, type
322 @samp{mkdir practice} at the system prompt. It will probably be
323 easiest to create the files using a text editor, such as Emacs.)
324
325 First, change into the directory containing the files you want to
326 archive:
327
328 @example
329 % cd practice
330 @end example
331
332 @noindent
333 @file{~/practice} is now your working directory.
334
335 Then, check that the files to be archived do in fact exist in the
336 working directory, and make sure there isn't already a file in the
337 working directory with the archive name you intend to use. If you
338 specify an archive file name that is already in use, @code{tar} will
339 overwrite the old file and its contents will be lost.
340
341 To list the names of files in the working directory, type:
342
343 @example
344 % ls
345 @end example
346
347 The system responds:
348
349 @example
350 blues folk jazz
351 %
352 @end example
353
354 @noindent
355 Then,
356 @itemize @bullet
357 @item
358 Create a new archive (@samp{tar -c} or @samp{tar --create})
359
360 @item
361 Explicitly name the archive file being created (@samp{-f
362 @var{archive-name}} or @samp{--file=@var{archive-name}}). If you don't
363 use this option @code{tar} will write the archive to the default
364 storage device, which varies from system to system.
365 @c <<< this syntax may change. OK now---check before printing -ringo
366
367 @code{tar} interprets archive file names relative to the working
368 directory. Make sure you have write access to the working directory
369 before using @code{tar}.
370
371 @item
372 Specify which files to put into the archive (@code{tar} interprets
373 file names relative to the working directory). If you don't use any
374 @var{file-name} arguments, @code{tar} will archive everything in the
375 working directory.
376 @end itemize
377
378 @noindent
379 Type:
380 @example
381 % tar --create --file=records blues folk jazz
382 @end example
383
384 @noindent
385 If you now list the contents of the working directory (@samp{ls}), you
386 will find the archive file listed as well as the files you saw
387 previously.
388
389 @example
390 % ls
391 blues folk jazz records
392 %
393 @end example
394
395 @menu
396 * Listing Files:: Listing files in an archive
397 * Verbose:: Using @code{tar} in Verbose Mode
398 @end menu
399
400 @node Listing Files, Verbose, Creating Example, Creating Example
401 @subsubsection Listing files in an archive
402
403 You can list the contents of an archive with another operation of
404 @code{tar}---@samp{--list} or @samp{-l}. To list the contents of the
405 archive you just created, type:
406
407 @example
408 % tar --list --file=records
409 @end example
410
411 @noindent
412 @code{tar} will respond:
413
414 @example
415 blues folk jazz
416 @end example
417
418 @xref{Listing Archive Contents}, for a more detailed tutorial of the
419 @samp{--list} operation. @xref{Listing Contents}, for more information
420 about the @samp{--list} operation.
421
422 @node Verbose, , Listing Files, Creating Example
423 @subsubsection Using @code{tar} in Verbose Mode
424
425 If you include the @samp{--verbose} or @samp{-v} option on the command
426 line, @code{tar} will list the files it is acting on as it is working.
427 In verbose mode, the creation example above would appear as:
428 @cindex Verbose mode example
429 @findex -v (verbose mode example)
430
431 @example
432 % tar --create --file=records --verbose blues folk jazz
433 blues
434 folk
435 jazz
436 @end example
437
438 @noindent
439 The first line is the command typed in by the user. The remaining
440 lines are generated by @code{tar}. In the following examples we
441 usually use verbose mode, though it is almost never required.
442
443 @node Subdirectory, Changing, Creating Example, Creating Archives
444 @subsection Creating an Archive of a Subdirectory
445
446 You can store a directory in an archive by using the directory name as
447 a file-name argument to @code{tar}. When you specify a directory
448 file, @code{tar} archives the directory file and all the files it
449 contains. The names of the directory and the files it contains are
450 stored in the archive relative to the current working directory---when
451 the directory is extracted they will be written into the file system
452 relative to the working directory at that time.
453 @c <<< add an xref to --absolute-paths -ringo
454
455 To archive a directory, first move to its superior directory. If you
456 have been following the tutorial, you should type:
457
458 @example
459 % cd ..
460 %
461 @end example
462
463 Once in the superior directory, specify the subdirectory using a
464 file-name argument. To store the directory file @file{~/practice} in
465 the archive file @file{music}, type:
466
467 @example
468 % tar --create --verbose --file=music practice
469 @end example
470
471 @noindent
472 @code{tar} should respond:
473
474 @example
475 practice/
476 practice/blues
477 practice/folk
478 practice/jazz
479 practice/records
480 @end example
481
482 Note that @file{~/practice/records}, another archive file, has
483 itself been archived. @code{tar} will accept any file as a file to be
484 archived, even an archive file.
485
486 @c >>> symbolic links and changing directories are now in main body, not in
487 @c >>> tutorial. -ringo
488
489 @node Extracting Files
490 @section Extracting Files from an Archive
491
492 Creating an archive is only half the job---there would be no point in
493 storing files in an archive if you couldn't retrieve them. To extract
494 files from an archive, use the @samp{--extract} or @samp{-x} operation.
495
496 To extract specific files, use their names as file-name arguments. If
497 you use a directory name as a file-name argument, @code{tar} extracts
498 all the files (including subdirectories) in that directory. If you
499 don't use any file-name arguments, @code{tar} extracts all the files
500 in the archive.
501
502 Note: @code{tar} will extract an archive member into the file system
503 without checking to see if there is already a file with the archive
504 member's file name. If there is a file with that name, @code{tar}
505 will @strong{overwrite} that file and its contents will be lost.
506 @c <<<xref keep-old -ringo
507
508 @node Extracting Specific Files, , ,
509 @subsection Extracting Specific Files
510
511 To extract specific files, specify them using file-name arguments.
512
513 In an example above, you created the archive file
514 @file{~/practice/records}, which contained the files @file{blues},
515 @file{folk} and @file{jazz} in the @file{practice} directory. If, for
516 some reason, you were to lose one of those text files (@samp{rm
517 ~/practice/blues}), you could extract it from the archive file.
518
519 First, change into the @file{practice} directory. Then,
520
521 @itemize @bullet
522 @item
523 Invoke @code{tar} and specify the @samp{--extract} operation
524 (@samp{--extract}, @samp{--get} or @samp{-x})
525
526 @item
527 Specify the archive that the files will be extracted from
528 (@samp{--file=@var{archive-name}} or @samp{-f @var{archive-name}})
529
530 @item
531 Specify the files to extract, using file-name arguments (if you don't
532 specify any files, @code{tar} extracts all the archive members)
533 @end itemize
534
535 @example
536 % tar --extract --file=records blues
537 @end example
538
539 If you list the contents of the directory, you will see that
540 @file{blues} is back:
541
542 @example
543 % ls
544 folk
545 jazz
546 records
547 blues
548 @end example
549
550 @node Extracting Directories, , ,
551 @subsection Extracting Directories
552
553 To extract a directory and all the files it contains, use the
554 directory's name as a file-name argument in conjunction with @samp{tar
555 --extract}. Remember---@code{tar} stores and extracts file names
556 relative to the working directory.
557
558 In a previous example you stored the directory @file{~/practice} in
559 the archive file @file{~/music}. If you delete the contents of
560 @file{practice}, you can restore them using @code{tar}.
561
562 First, change into the @file{practice} subdirectory (@samp{cd
563 ~/practice}). Then, remove all the files in @samp{~/practice}
564 (@samp{rm *}). If you list the contents of the directory, you should
565 now see that it is empty:
566
567 @example
568 %ls
569 %
570 @end example
571
572 @noindent Let's try to restore the contents of @file{practice} by extracting
573 them from the archive file @file{~/music}:
574
575 @example
576 tar --extract --file=~/music practice
577 @end example
578
579 @noindent Now, list the contents of @file{practice} again:
580
581 @example
582 %ls
583 practice
584 @end example
585
586 What happened to the files? When you created @file{~/music}, your
587 working directory was your home directory. When you extracted
588 @file{~/music}, your working directory was @file{~/practice}.
589 @code{tar} stored the files in @file{practice} relative to your home
590 directory, and then extracted them relative to @file{~/practice}. The
591 files are now in a new subdirectory, called
592 @file{~/practice/practice}.
593
594 To restore your files to their old positions, delete the new directory
595 and its contents, and then redo the example above with your home
596 directory as the working directory:
597
598 @example
599 % rm ~/practice/practice/*
600 % rmdir practice
601 % cd ..
602 % tar --extract --file=music practice
603 @end example
604
605 @noindent (@code{tar} will report that it is unable to create the
606 directory @file{~/practice} because it already exists. This will not
607 effect the extraction of the other archive members.)
608
609 @node Listing Archive Contents, Adding to Archives, Creating Archives, Tutorial
610 @section Listing the Contents of an Archive
611
612 Use @samp{--list} or @samp{-t} to print the names of files stored in an
613 archive. If you use file-name arguments with this operation,
614 @code{tar} prints the names of the specified files if they are stored
615 in the archive. If you use a directory name as a file-name argument,
616 @code{tar} also prints the names of all underlying files, including
617 sub-directories. If you use no file-name arguments, @code{tar} prints
618 the names of all the archive members.
619
620 You can use @samp{--list} with the @samp{--verbose} option to print
621 archive members' attributes (owner, size, etc.).
622
623 @menu
624 * Listing names:: Listing the names of stored files
625 * Additional File Info:: Getting Additional File Information
626 * Specific File:: List A Specific File in an Archive
627 * Listing Directories:: Listing the Contents of a Stored Directory
628 @end menu
629
630 @node Listing names, Additional File Info, Listing Archive Contents, Listing Archive Contents
631 @subsection Listing the names of stored files
632
633 To list the names of files stored in an archive, use the @samp{--list}
634 operation of @code{tar}.
635
636 In a previous example, you created the archive @file{~/music}. To
637 list the contents of @file{music}, while in your home directory:
638
639 @itemize @bullet
640 @item
641 List the contents of an archive (@samp{tar -t} or @samp{tar --list})
642
643 @item
644 Specify the archive to be listed (@samp{-f @var{archive-name}} or
645 @samp{--file=@var{archive-name}}) @refill
646 @end itemize
647
648 Thus:
649
650 @example
651 % tar --list --file=music
652 practice/
653 practice/blues
654 practice/folk
655 practice/jazz
656 practice/records
657 @end example
658
659 @node Additional File Info, Specific File, Listing names, Listing Archive Contents
660 @subsection Listing Additional File Information
661
662 To get more information when you list the names of files stored in an
663 archive, specify the @samp{--verbose} option in conjunction with
664 @samp{tar --list}. @code{tar} will print archive member's file
665 protection, owner and group ID, size, and date and time of creation.
666
667 For example:
668
669 @example
670 % tar --list --verbose --file=music
671 drwxrwxrwx myself/user 0 May 31 21:49 1990 practice/
672 -rw-rw-rw- myself/user 42 May 21 13:29 1990 practice/blues
673 -rw-rw-rw- myself/user 62 May 23 10:55 1990 practice/folk
674 -rw-rw-rw- myself/user 40 May 21 13:30 1990 practice/jazz
675 -rw-rw-rw- myself/user 10240 May 31 21:49 1990 practice/records
676 %
677 @end example
678
679 Note that when you use @samp{--verbose} with @samp{--list}, @code{tar}
680 doesn't print the names of files as they are being acted on, though
681 the @samp{--verbose} option will have this effect when used with all
682 other operations.
683
684 @node Specific File, Comparing Files, Additional File Info, Listing Archive Contents
685 @subsection List A Specific File in an Archive
686
687 To to see if a particular file is in an archive, use the name of the
688 file in question as a file-name argument while specifying the
689 @samp{--list} operation. For example, to see whether the file
690 @file{folk} is in the archive file @file{music}, do the following:
691
692 @itemize @bullet
693 @item
694 Invoke @code{tar}, and specify the @samp{--list} operation
695 (@samp{--list} or @samp{-t}).
696
697 @item
698 Specify the archive file to be acted on (@samp{--file
699 @var{archive-name}} or @samp{-f @var{archive-name}}).
700
701 @item
702 Specify the files to look for, by typing their names as file-name
703 arguments. You have to type the file name as it appears in the
704 archive (normally, as it is relative to the relative to the directory
705 from which the archive was created). <<< xref absolute-paths -ringo
706 @end itemize
707
708 Type:
709
710 @example
711 % tar --list --file=music practice/folk
712 @end example
713
714 @noindent
715 @code{tar} responds:
716
717 @example
718 practice/folk
719 @end example
720
721 @noindent
722 If the file were not stored in the archive (for example, the file
723 @file{practice/rock}), the example above would look like:
724
725 @example
726 % tar --list --file=music practice/rock
727 tar: practice/rock not found in archive
728 @end example
729
730 @noindent
731 If you had used @samp{--verbose} mode, the example above would look
732 like:
733
734 @example
735 % tar --list --file=music practice/folk
736 -rw-rw-rw- myself/user 62 May 23 10:55 1990 practice/folk
737 @end example
738
739 @node Listing Directories, , ,
740 @subsection Listing the Contents of a Stored Directory
741
742 To get information about the contents of an archived directory, use
743 the directory name as a file-name argument in conjunction with
744 @samp{--list}. To find out file attributes, include the
745 @samp{--verbose} option.
746
747 For example, to find out about files in the directory @file{practice},
748 in the archive file @file{music}, type:
749
750 @example
751 % tar --list --file=music practice
752 @end example
753
754 @noindent @code{tar} responds:
755
756 @example
757 drwxrwxrwx myself/user 0 May 31 21:49 1990 practice/
758 -rw-rw-rw- myself/user 42 May 21 13:29 1990 practice/blues
759 -rw-rw-rw- myself/user 62 May 23 10:55 1990 practice/folk
760 -rw-rw-rw- myself/user 40 May 21 13:30 1990 practice/jazz
761 -rw-rw-rw- myself/user 10240 May 31 21:49 1990 practice/records
762 @end example
763
764 When you use a directory name as a file-name argument, @code{tar} acts
765 on all the files (including sub-directories) in that directory.
766
767 @node Comparing Files, , ,
768 @section Comparing Files in an Archive with Files in the File System
769
770 To compare the attributes of archive members with the attributes of
771 their counterparts in the file system, use the @samp{--compare},
772 @samp{--diff}, or @samp{-d}) operation. While you could use
773 @samp{--list --verbose} to manually compare some file attributes, it is
774 simpler to have @code{tar} itself compare file attributes and report
775 back on file differences.
776 @c <<<"manually"? suggestions? -ringo
777
778 The @samp{--compare} operation, as its name implies, compares archive
779 members with files of the same name in the file system, and reports
780 back differences in file size, mode, owner and modification date.
781 @samp{tar --compare} acts only on archive members---it ignores files in
782 the file system that are not stored in the archive. If you give
783 @samp{tar --compare} a file-name argument that does not correspond to
784 the name of an archive member, @code{tar} responds with an error
785 message.
786
787 To compare archive members in the archive file @file{records} with
788 files in the @file{~/practice} directory, first change into the
789 @file{practice} directory. Then:
790
791 @itemize @bullet
792 @item
793 Invoke @code{tar} and specify the @samp{--compare} operation.
794 (@samp{--compare}, @samp{--diff}, or @samp{-d}).
795
796 @item
797 Specify the archive where the files to be compared are stored
798 (@samp{--file=@var{archive-name}} or @samp{-f @var{archive-name}})
799
800 @item
801 Specify the archive members to be compared. (In this example you are
802 comparing all the archive members in the archive. Since this is the
803 default, you don't need to use any file-name arguments).
804 @end itemize
805
806 @example
807 % tar --compare --file=records
808 %
809 @end example
810
811 @noindent
812 While it looks like nothing has happened, @code{tar} has, in fact,
813 done the comparison---and found nothing to report.
814
815 Use the @samp{--verbose} option to list the names of archive members as
816 they are being compared with their counterparts of the same name in
817 the file system:
818
819 @example
820 % tar --compare --verbose --file=records
821 blues
822 folk
823 jazz
824 %
825 @end example
826
827 @noindent
828 If @code{tar} had had anything to report, it would have done so as it
829 was comparing each file.
830
831 If you remove the file @file{jazz} from the file system (@samp{rm
832 jazz}), and modify the file @file{blues} (for instance, by adding text
833 to it with an editor such as Emacs), the above example would look
834 like:
835
836 @example
837 % tar --compare --verbose --file=records
838 blues
839 blues: mod time differs
840 blues: size differs
841 folk
842 jazz
843 jazz: does not exist
844 %
845 @end example
846
847 Note again that while @samp{tar --compare} reports the names of archive
848 members that do not have counterparts in the file system, @samp{tar
849 --compare} ignores files in the file system that do not have
850 counterparts in the archive. To demonstrate this, create a file in
851 the @file{practice} directory called @file{rock} (using any text
852 editor). The new file appears when you list the directory's contents:
853
854 @example
855 % ls
856 blues folk records rock
857 @end example
858
859 @noindent
860 If you type the @samp{--compare} example again, @code{tar} prints the
861 following:
862
863 @example
864 % tar --compare --verbose --file=records
865 blues
866 blues: mod time differs
867 blues: size differs
868 folk
869 jazz
870 jazz: does not exist
871 %
872 @end example
873
874 @noindent
875 @code{tar} ignores the file @file{rock} because @code{tar} is
876 comparing archive members to files in the file system, not vice versa.
877
878 If you specify @file{rock} explicitly (using a file-name argument),
879 @code{tar} prints an error message:
880
881 @example
882 % tar --compare --verbose --file=records rock
883 tar: rock not found in archive
884 %
885 @end example
886
887 @menu
888 * Comparing Directories:: Using Compare on Directories
889 @end menu
890
891 @node Comparing Directories, , ,
892 @subsubsection Using Compare on Directories
893
894 In addition to using @samp{--compare} to compare text files, you can
895 use @samp{--compare} to compare directories. To illustrate this,
896 re-create the examples above using your home directory as the working
897 directory, and using the archive file @file{~/music} instead of the
898 archive file @file{~/practice/records}.
899
900 First, change into your home directory (@samp{cd ~}). Then, try the
901 above example using @file{music} as the specified archive file, and
902 @file{practice} as a file-name argument.
903
904 @example
905 % tar --compare --verbose --file=music practice
906 @end example
907
908 @noindent
909 If you have been following along with the tutorial, @code{tar} will
910 respond:
911
912 @example
913 practice
914 practice/blues
915 practice/blues: mod time differs
916 practice/blues: size differs
917 practice/folk
918 practice/jazz
919 practice/jazz: does not exist
920 practice/records
921 @end example
922
923 @node Adding to Archives, Concatenate, Listing Archive Contents, Tutorial
924 @section Adding Files to Existing Archives
925
926 @c >>> we want people to use the script for backups, so I an not going to
927 @c >>> use backups as an explanation in the tutorial. (people can still
928 @c >>> do it if they really want to) -ringo
929
930 While you can use @code{tar} to create a new archive every time you
931 want to store a file, it is more sometimes efficient to add files to
932 an existing archive.
933
934 To add new files to an existing archive, use the @samp{--add-file},
935 @samp{--append} or @samp{-r} operation. To add newer versions of
936 archive members to an archive, use the @samp{--update} or @samp{-u}
937 operation.
938
939 @menu
940 * Append:: Appending Files to an Archive
941 * Update:: Updating Files in an Archive
942 @end menu
943
944 @node Append, Update, Adding to Archives, Adding to Archives
945 @subsection Appending Files to an Archive
946
947 The simplest method of adding a file to an existing archive is the
948 @samp{--add-file}, @samp{-r} or @samp{--append} operation, which writes
949 files into the archive without regard to whether or not they are
950 already archive members. When you use @samp{--add-file} you must use
951 file-name arguments; there is no default. If you specify a file that
952 is already stored in the archive, @code{tar} adds another copy of the
953 file to the archive.
954
955 If you have been following the previous examples, you should have a
956 text file called @file{~/practice/rock} which has not been stored in
957 either the archive file @file{~/practice/records}, or the archive file
958 @file{~/music}. To add @file{rock} to @file{records}, first make
959 @file{practice} the working directory (@samp{cd practice}). Then:
960
961 @itemize @bullet
962 @item
963 Invoke @code{tar} and specify the @samp{--add-file} operation
964 (@samp{--add-file}, @samp{-r} or @samp{--append})
965
966 @item
967 Specify the archive to which the file will be added
968 (@samp{--file=@var{archive-name}} or @samp{-f @var{archive-name}})
969
970 @item
971 Specify the files to be added to the archive, using file-name
972 arguments
973 @end itemize
974
975 @noindent
976 For example:
977
978 @example
979 % tar --add-file --file=records rock
980 @end example
981
982 @noindent
983 If you list the archive members in @file{records}, you will see that
984 @file{rock} has been added to the archive:
985
986 @example
987 % tar --list --file=records
988 blues
989 folk
990 jazz
991 rock
992 @end example
993
994 @c <<< this should be some kind of node.
995
996 You can use @samp{--add-file} to keep archive members current with
997 active files. Because @samp{--add-file} stores a file whether or not
998 there is already an archive member with the same file name, you can
999 use @samp{--add-file} to add newer versions of archive members to an
1000 archive. When you extract the file, only the version stored last will
1001 wind up in the file system. Because @samp{tar --extract} extracts
1002 files from an archive in sequence, and overwrites files with the same
1003 name in the file system, if a file name appears more than once in an
1004 archive the last version of the file will overwrite the previous
1005 versions which have just been extracted.
1006
1007 If you recall from the examples using @samp{--compare} above,
1008 @file{blues} was changed after the archive @file{records} was created.
1009 It is simple, however, to use @samp{--add-file} to add the new version
1010 of @file{blues} to @file{records}:
1011
1012 @example
1013 % tar --add-file --verbose --file=records blues
1014 blues
1015 @end example
1016
1017 @noindent
1018 If you now list the contents of the archive, you will obtain the following:
1019
1020 @example
1021 % tar --list -f records
1022 blues
1023 folk
1024 jazz
1025 rock
1026 blues
1027 @end example
1028
1029 @noindent
1030 The newest version of @file{blues} is at the end of the archive. When
1031 the files in @file{records} are extracted, the newer version of
1032 @file{blues} (which has the same name as the older) will overwrite the
1033 version stored first. When @samp{tar --extract} is finished, only the
1034 newer version of @file{blues} is in the file system. <<<xref
1035 keep-old-files>>>
1036
1037 @node Update, , Append, Adding to Archives
1038 @subsection Updating Files in an Archive
1039
1040 To keep archive members up to date with their counterparts of the same
1041 name in the file system, use the @samp{--update} or @samp{-u}
1042 operation. @samp{tar --update} adds a specified file to an archive if
1043 no file of that name is already stored in the archive. If there is
1044 already an archive member with the same name, @code{tar} checks the
1045 modification date of the archive member, and adds the file only if its
1046 modification date is later. If a file is stored in the archive but no
1047 longer exists under the same name in the active file system,
1048 @code{tar} reports an error.
1049
1050 You could use the @samp{--add-file} option to keep an archive current,
1051 but do so you would either have to use the @samp{--compare} and
1052 @samp{--list} options to determine what files needed to be re-archived
1053 (which could waste a lot of time), or you would have to be willing to
1054 add identical copies of already archived files to the archive (which
1055 could waste a lot of space).
1056
1057 You must use file-name arguments with the @samp{--update}
1058 operation---if you don't specify any files, @code{tar} won't act on
1059 any files.
1060
1061 To see the @samp{--update} option at work, create a new file,
1062 @file{~/practice/classical}, and modify the file
1063 @file{~/practice/blues} (you can use a text editor, such as Emacs, to
1064 do both these things). Then, with @file{practice} as your working
1065 directory, invoke @samp{tar --update} using the names of all the files
1066 in the practice directory as file-name arguments, and specifying the
1067 @samp{--verbose} option:
1068
1069 @example
1070 % tar --update --verbose --file=records blues folk rock classical
1071 blues
1072 classical
1073 %
1074 @end example
1075
1076 @noindent
1077 Because you specified verbose mode, @code{tar} printed out the names
1078 of the files it acted on. If you now list the archive members of the
1079 archive, (@samp{tar --list --file=records}), you will see that the file
1080 @file{classical} and another version of the file @file{blues} have
1081 been added to @file{records}.
1082
1083 Note: When you update an archive, @code{tar} does not overwrite old
1084 archive members when it stores newer versions of a file. This is
1085 because archive members appear in an archive in the order in which
1086 they are stored, and some archive devices do not allow writing in the
1087 middle of an archive.
1088
1089 @node Concatenate, Extracting Files Example, Adding to Archives, Tutorial
1090 @comment node-name, next, previous, up
1091 @section Concatenating Archives
1092
1093 To concatenate archive files, use @samp{tar --concatenate} or @samp{tar
1094 -A}. This operation adds other archives to the end of an archive.
1095 While it may seem intuitive to concatenate archives using @code{cat},
1096 the utility for adding files together, archive files which have been
1097 "catted" together cannot be read properly by @code{tar}. Archive
1098 files incorporate an end of file marker---if archives are concatenated
1099 using @code{cat}, this marker will appear before the end of the new
1100 archive. This will interfere with operations on that archive.
1101 @c <<<xref ignore-zeros>>>
1102
1103 In earlier examples, you stored the @file{~/practice} directory in an
1104 archive file, @file{~/music}. If you have been following the
1105 examples, you have since changed the contents of the @file{~/practice}
1106 directory. There is a current version of the files in the
1107 @file{practice} directory, however, stored in the archive file
1108 @file{~/practice/records}.
1109
1110 To store current versions of the files in @file{practice} in the
1111 archive file @file{music}, you can use @samp{tar --concatenate} to add
1112 the archive file @file{~/practice/records} to @file{music}. First,
1113 make sure you are in your home directory (@samp{cd ~}). Then:
1114
1115 @itemize @bullet
1116 @item
1117 Invoke @code{tar}, and specify the @samp{--concatenate} operation
1118 (@samp{-A} or @samp{--concatenate})
1119
1120 @item
1121 Specify the archive file to be added to
1122 (@samp{--file=@var{archive-name}} or @samp{-f @var{archive-name}})
1123
1124 @item
1125 Specify the archives to be added, using file-name arguments. In this
1126 case, the file-name arguments are, unusually, the names of archive
1127 files. (Remember to include the path in the archive name, if the
1128 archive file is not in your working directory.)
1129 @end itemize
1130
1131 @example
1132 % cd ~
1133 % tar --concatenate --file=music practice/records
1134 @end example
1135
1136 If you now list the contents of the @file{music}, you see it now
1137 contains the archive members of @file{practice/records}:
1138
1139 @example
1140 %tar --list --file=music
1141 blues
1142 folk
1143 jazz
1144 rock
1145 blues
1146 practice/blues
1147 practice/folk
1148 practice/jazz
1149 practice/rock
1150 practice/blues
1151 practice/classical
1152 @end example
1153
1154 @node Deleting Files, , , Tutorial
1155 @comment node-name, next, previous, up
1156 @section Deleting Files From an Archive
1157
1158 In some instances, you may want to remove some files from an archive
1159 stored on disk
1160
1161 @quotation
1162 @emph{Caution:} you should never delete files from an archive stored
1163 on tape---because of the linear nature of tape storage, doing this is
1164 likely to scramble the archive.
1165 @end quotation
1166
1167 To remove archive members from an archive, use the @samp{--delete}
1168 operation. You must specify the names of files to be removed as
1169 file-name arguments. All versions of the named file are removed from
1170 the archive.
1171
1172 Execution of the @samp{--delete} operation can be very slow.
1173
1174 To delete all versions of the file @file{blues} from the archive
1175 @file{records} in the @file{practice} directory, make sure you are in
1176 that directory, and then:
1177
1178 @itemize @bullet
1179 @item
1180 List the contents of the archive file @file{records} (see above for
1181 the steps involved) to insure that the file(s) you wish to delete are
1182 stored in the archive. (This step is optional)
1183
1184 @item
1185 Invoke @code{tar} and specify the @samp{--delete} operation
1186 (@samp{--delete}).
1187
1188 @item
1189 Specify the name of the archive file that the file(s) will be deleted
1190 from (@samp{--file=@var{archive-name}} or @samp{-f @var{archive-name}})
1191
1192 @item
1193 Specify the files to be deleted, using file-name arguments.
1194
1195 @item
1196 List the contents of the archive file again---note that the files have
1197 been removed. (this step is also optional)
1198 @end itemize
1199
1200 @example
1201 % tar --list --file=records
1202 blues
1203 folk
1204 jazz
1205 % tar --delete --file=records blues
1206 % tar --list --file=records
1207 folk
1208 jazz
1209 %
1210 @end example
1211
1212 @node Wizardry, Archive Structure, Tutorial, Top
1213 @chapter Wizardry
1214
1215 <<<This section needs to be written -ringo
1216
1217 @strong{To come:} using Unix file linking capability to recreate directory
1218 structures---linking files into one subdirectory and then tarring that
1219 directory.
1220
1221 @strong{to come:} nice hairy example using absolute-paths, newer, etc.
1222
1223
1224 Piping one @code{tar} to another is an easy way to copy a directory's
1225 contents from one disk to another, while preserving the dates, modes, owners
1226 and link-structure of all the files therein.
1227
1228 @example
1229 cd sourcedirectory; tar cf - . | (cd targetdir; tar xf -)
1230 @end example
1231
1232 @noindent
1233 or
1234
1235 <<< the following using standard input/output correct??
1236 @example
1237 cd sourcedirectory; tar --create --file=- . | (cd targetdir; tar --extract --file=-)
1238 @end example
1239
1240 @noindent
1241
1242 Archive files can be used for transporting a group of files from one system
1243 to another: put all relevant files into an archive on one computer system,
1244 transfer the archive to another, and extract the contents there. The basic
1245 transfer medium might be magnetic tape, Internet FTP, or even electronic
1246 mail (though you must encode the archive with @code{uuencode} in order to
1247 transport it properly by mail). Both machines do not have to use the same
1248 operating system, as long as they both support the @code{tar} program.
1249 @findex uuencode
1250 <<< mention uuencode on a paragraph of its own
1251
1252 <<<<<end construction>>>>>
1253
1254 @node Archive Structure, Reading and Writing, Wizardry, Top
1255 @chapter The Structure of an Archive
1256
1257 While an archive may contain many files, the archive itself is a
1258 single ordinary file. Like any other file, an archive file can be
1259 written to a storage device such as a tape or disk, sent through a
1260 pipe or over a network, saved on the active file system, or even
1261 stored in another archive. An archive file is not easy to read or
1262 manipulate without using the @code{tar} utility or Tar mode in Emacs.
1263
1264
1265 Physically, an archive consists of a series of file entries terminated
1266 by an end-of-archive entry, which consists of 512 zero bytes. A file
1267 entry usually describes one of the files in the archive (an
1268 @dfn{archive member}), and consists of a file header and the contents
1269 of the file. File headers contain file names and statistics, checksum
1270 information which @code{tar} uses to detect file corruption, and
1271 information about file types.
1272
1273 More than archive member can have the same file name. One way this
1274 situation can occur is if more than one version of a file has been
1275 stored in the archive. For information about adding new versions of a
1276 file to an archive, @pxref{Modifying}.
1277
1278 In addition to entries describing archive members, an archive may contain
1279 entries which @code{tar} itself uses to store information.
1280 @xref{Archive Label}, for an example of such an archive entry.
1281
1282 @menu
1283 * Old Style File Information:: Old Style File Information
1284 * Archive Label::
1285 * Format Variations::
1286 @end menu
1287
1288 @node Old Style File Information, Archive Label, Archive Structure, Archive Structure
1289 @section Old Style File Information
1290 @cindex Format, old style
1291 @cindex Old style format
1292 @cindex Old style archives
1293
1294 Archives record not only an archive member's contents, but also its
1295 file name or names, its access permissions, user and group, size in
1296 bytes, and last modification time. Some archives also record the file
1297 names in each archived directory, as well as other file and directory
1298 information.
1299
1300 Certain old versions of @code{tar} cannot handle additional
1301 information recorded by newer @code{tar} programs. To create an
1302 archive which can be read by these old versions, specify the
1303 @samp{--old-archive} option in conjunction with the @samp{tar --create}
1304 operation. When you specify this option, @code{tar} leaves out
1305 information about directories, pipes, fifos, contiguous files, and
1306 device files, and specifies file ownership by group and user ids
1307 instead of names.
1308
1309 The @samp{--old-archive} option is needed only if the archive must be
1310 readable by an older tape archive program which cannot handle the new format.
1311 Most @code{tar} programs do not have this limitation, so this option
1312 is seldom needed.
1313
1314 @table @samp
1315 @item --old-archive
1316 @itemx -o
1317 @itemx --old
1318 @itemx --portable
1319 @c has portability been changed to portable?
1320 Creates an archive that can be read by an old @code{tar} program.
1321 Used in conjunction with the @samp{tar --create} operation.
1322 @end table
1323
1324 @node Archive Label, Format Variations, Old Style File Information, Archive Structure
1325 @section Including a Label in the Archive
1326 @cindex Labeling an archive
1327 @cindex Labels on the archive media
1328
1329 @c !! Should the arg to --label be a quoted string?? no - ringo
1330 To avoid problems caused by misplaced paper labels on the archive
1331 media, you can include a @dfn{label} entry---an archive member which
1332 contains the name of the archive---in the archive itself. Use the
1333 @samp{--label=@var{archive-label}} option in conjunction with the
1334 @samp{--create} operation to include a label entry in the archive as it
1335 is being created.
1336
1337 If you create an archive using both @samp{--label=@var{archive-label}}
1338 and @samp{--multi-volume}, each volume of the archive will have an
1339 archive label of the form @samp{@var{archive-label} Volume @var{n}},
1340 where @var{n} is 1 for the first volume, 2 for the next, and so on.
1341 @xref{Multi-Volume Archives}, for information on creating multiple
1342 volume archives.
1343
1344 If you extract an archive using @samp{--label=@var{archive-label}},
1345 @code{tar} will print an error if the archive label doesn't match the
1346 @var{archive-label} specified, and will then not extract the archive.
1347 You can include a regular expression in @var{archive-label}, in this
1348 case only.
1349 @c >>> why is a reg. exp. useful here? (to limit extraction to a
1350 @c >>>specific group? ie for multi-volume??? -ringo
1351
1352 To find out an archive's label entry (or to find out if an archive has
1353 a label at all), use @samp{tar --list --verbose}. @code{tar} will print the
1354 label first, and then print archive member information, as in the
1355 example below:
1356
1357 @example
1358 % tar --verbose --list --file=iamanarchive
1359 V--------- 0/0 0 Mar 7 12:01 1992 iamalabel--Volume Header--
1360 -rw-rw-rw- ringo/user 40 May 21 13:30 1990 iamafilename
1361 @end example
1362
1363 @table @samp
1364 @item --label=@var{archive-label}
1365 @itemx -V @var{archive-label}
1366 Includes an @dfn{archive-label} at the beginning of the archive when
1367 the archive is being created (when used in conjunction with the
1368 @samp{tar --create} operation). Checks to make sure the archive label
1369 matches the one specified (when used in conjunction with the @samp{tar
1370 --extract} operation.
1371 @end table
1372 @c was --volume
1373
1374 @node Format Variations, , Archive Label, Archive Structure
1375 @section Format Variations
1376 @cindex Format Parameters
1377 @cindex Format Options
1378 @cindex Options to specify archive format.
1379
1380 Format parameters specify how an archive is written on the archive
1381 media. The best choice of format parameters will vary depending on
1382 the type and number of files being archived, and on the media used to
1383 store the archive.
1384
1385 To specify format parameters when accessing or creating an archive,
1386 you can use the options described in the following sections. If you
1387 do not specify any format parameters, @code{tar} uses default
1388 parameters. You cannot modify a compressed archive. If you create an
1389 archive with the @samp{--block-size} option specified (@pxref{Blocking
1390 Factor}), you must specify that block-size when operating on the
1391 archive. @xref{Matching Format Parameters}, for other examples of
1392 format parameter considerations.
1393
1394
1395 @menu
1396 * Multi-Volume Archives::
1397 * Sparse Files::
1398 * Blocking Factor::
1399 * Compressed Archives::
1400 @end menu
1401
1402 @node Multi-Volume Archives, Sparse Files, Format Variations, Format Variations
1403 @subsection Archives Longer than One Tape or Disk
1404 @cindex Multi-volume archives
1405
1406 To create an archive that is larger than will fit on a single unit of
1407 the media, use the @samp{--multi-volume} option in conjunction with the
1408 @samp{tar --create} operation (@pxref{Creating Archives}). A
1409 @dfn{multi-volume} archive can be manipulated like any other archive
1410 (provided the @samp{--multi-volume} option is specified), but is stored
1411 on more than one tape or disk.
1412
1413 When you specify @samp{--multi-volume}, @code{tar} does not report an
1414 error when it comes to the end of an archive volume (when reading), or
1415 the end of the media (when writing). Instead, it prompts you to load
1416 a new storage volume. If the archive is on a magnetic tape, you
1417 should change tapes when you see the prompt; if the archive is on a
1418 floppy disk, you should change disks; etc.
1419
1420 You can read each individual volume of a multi-volume archive as if it
1421 were an archive by itself. For example, to list the contents of one
1422 volume, use @samp{tar --list}, without @samp{--multi-volume} specified.
1423 To extract an archive member from one volume (assuming it is described
1424 that volume), use @samp{tar --extract}, again without
1425 @samp{--multi-volume}.
1426
1427 If an archive member is split across volumes (ie. its entry begins on
1428 one volume of the media and ends on another), you need to specify
1429 @samp{--multi-volume} to extract it successfully. In this case, you
1430 should load the volume where the archive member starts, and use
1431 @samp{tar --extract --multi-volume}---@code{tar} will prompt for later
1432 volumes as it needs them. @xref{Extracting From Archives} for more
1433 information about extracting archives.
1434
1435 @samp{--info-script=@var{program-file}} is like @samp{--multi-volume},
1436 except that @code{tar} does not prompt you directly to change media
1437 volumes when a volume is full---instead, @code{tar} runs commands you
1438 have stored in @var{program-file}. This option can be used to
1439 broadcast messages such as @samp{someone please come change my tape}
1440 when performing unattended backups. When @var{program-file} is done,
1441 @code{tar} will assume that the media has been changed.
1442
1443
1444 <<< There should be a sample program here, including an exit before
1445 <<< end.
1446
1447 @table @samp
1448 @item --multi-volume
1449 @itemx -M
1450 Creates a multi-volume archive, when used in conjunction with
1451 @samp{tar --create}. To perform any other operation on a multi-volume
1452 archive, specify @samp{--multi-volume} in conjunction with that
1453 operation.
1454
1455 @item --info-script=@var{program-file}
1456 @itemx -F @var{program-file}
1457 Creates a multi-volume archive via a script. Used in conjunction with
1458 @samp{tar --create}.
1459 @end table
1460
1461 @node Sparse Files, Blocking Factor, Multi-Volume Archives, Format Variations
1462 @subsection Archiving Sparse Files
1463 @cindex Sparse Files
1464
1465 A file is sparse if it contains blocks of zeros whose existance is
1466 recorded, but that have no space allocated on disk. When you specify
1467 the @samp{--sparse} option in conjunction with the @samp{--create}
1468 operation, @code{tar} tests all files for sparseness while archiving.
1469 If @code{tar} finds a file to be sparse, it uses a sparse
1470 representation of the file in the archive. @xref{Creating Archives},
1471 for more information about creating archives.
1472
1473 @samp{--sparse} is useful when archiving files, such as dbm files,
1474 likely to contain many nulls. This option dramatically
1475 decreases the amount of space needed to store such an archive.
1476
1477 @quotation
1478 @strong{Please Note:} Always use @samp{--sparse} when performing file
1479 system backups, to avoid archiving the expanded forms of files stored
1480 sparsely in the system.@refill
1481
1482 Even if your system has no no sparse files currently, some may be
1483 created in the future. If you use @samp{--sparse} while making file
1484 system backups as a matter of course, you can be assured the archive
1485 will always take no more space on the media than the files take on
1486 disk (otherwise, archiving a disk filled with sparse files might take
1487 hundreds of tapes).@refill
1488 <<< xref incremental when node name is set.
1489 @end quotation
1490
1491 @code{tar} ignores the @samp{--sparse} option when reading an archive.
1492
1493 @table @samp
1494 @item --sparse
1495 @itemx -S
1496 Files stored sparsely in the file system are represented sparsely in
1497 the archive. Use in conjunction with write operations.
1498 @end table
1499
1500 @node Blocking Factor, Compressed Archives, Sparse Files, Format Variations
1501 @subsection The Blocking Factor of an Archive
1502 @cindex Blocking Factor
1503 @cindex Block Size
1504 @cindex Number of records per block
1505 @cindex Number of bytes per block
1506 @cindex Bytes per block
1507 @cindex Records per block
1508
1509 The data in an archive is grouped into records, which are 512 bytes.
1510 Records are read and written in whole number multiples called
1511 @dfn{blocks}. The number of records in a block (ie. the size of a
1512 block in units of 512 bytes) is called the @dfn{blocking factor}. The
1513 @samp{--block-size=@var{number}} option specifies the blocking factor
1514 of an archive. The default blocking factor is typically 20 (ie.@:
1515 10240 bytes), but can be specified at installation. To find out the
1516 blocking factor of an existing archive, use @samp {tar --list
1517 --file=@var{archive-name}}. This may not work on some devices.
1518
1519 Blocks are seperated by gaps, which waste space on the archive media.
1520 If you are archiving on magnetic tape, using a larger blocking factor
1521 (and therefore larger blocks) provides faster throughput and allows
1522 you to fit more data on a tape (because there are fewer gaps). If you
1523 are archiving on cartridge, a very large blocking factor (say 126 or
1524 more) greatly increases performance. A
1525 smaller blocking factor, on the other hand, may be usefull when
1526 archiving small files, to avoid archiving lots of nulls as @code{tar}
1527 fills out the archive to the end of the block. In general, the ideal block size
1528 depends on the size of the inter-block gaps on the tape you are using,
1529 and the average size of the files you are archiving. @xref{Creating
1530 Archives}, for information on writing archives.
1531
1532 Archives with blocking factors larger than 20 cannot be read by very
1533 old versions of @code{tar}, or by some newer versions of @code{tar}
1534 running on old machines with small address spaces. With GNU
1535 @code{tar}, the blocking factor of an archive is limited only by the
1536 maximum block size of the device containing the archive, or by the
1537 amount of available virtual memory.
1538
1539 If you use a non-default blocking factor when you create an archive,
1540 you must specify the same blocking factor when you modify that
1541 archive. Some archive devices will also require you to specify the
1542 blocking factor when reading that archive, however this is not
1543 typically the case. Usually, you can use @samp{tar --list} without
1544 specifying a blocking factor---@code{tar} reports a non-default block
1545 size and then lists the archive members as it would normally. To
1546 extract files from an archive with a non-standard blocking factor
1547 (particularly if you're not sure what the blocking factor is), you can
1548 usually use the {--read-full-blocks} option while specifying a blocking
1549 factor larger then the blocking factor of the archive (ie. @samp{tar
1550 --extract --read-full-blocks --block-size=300}. @xref{Listing Contents}
1551 for more information on the @samp{--list} operation.
1552 @xref{read-full-blocks} for a more detailed explanation of that
1553 option.
1554
1555 @table @samp
1556 @item --block-size=@var{number}
1557 @itemx -b @var{number}
1558 Specifies the blocking factor of an archive. Can be used with any
1559 operation, but is usually not necessary with @samp{tar --list}.
1560 @end table
1561
1562 @node Compressed Archives, , Blocking Factor, Format Variations
1563 @subsection Creating and Reading Compressed Archives
1564 @cindex Compressed archives
1565 @cindex Storing archives in compressed format
1566
1567 @samp{--compress} indicates an archive stored in compressed format.
1568 The @samp{--compress} option is useful in saving time over networks and
1569 space in pipes, and when storage space is at a premium.
1570 @samp{--compress} causes @code{tar} to compress when writing the
1571 archive, or to uncompress when reading the archive.
1572
1573 To perform compression and uncompression on the archive, @code{tar}
1574 runs the @code{compress} utility. @code{tar} uses the default
1575 compression parameters; if you need to override them, avoid the
1576 @samp{--compress} option and run the @code{compress} utility
1577 explicitly. It is useful to be able to call the @code{compress}
1578 utility from within @code{tar} because the @code{compress} utility by
1579 itself cannot access remote tape drives.
1580
1581 The @samp{--compress} option will not work in conjunction with the
1582 @samp{--multi-volume} option or the @samp{--add-file}, @samp{--update},
1583 @samp{--add-file} and @samp{--delete} operations. @xref{Modifying}, for
1584 more information on these operations.
1585
1586 If there is no compress utility available, @code{tar} will report an
1587 error.
1588
1589 @samp{--compress-block} is like @samp{--compress}, but when used in
1590 conjunction with @samp{--create} also causes @code{tar} to pad the last
1591 block of the archive out to the next block boundary as it is written.
1592 This is useful with certain devices which require all write operations
1593 be a multiple of a specific size.
1594
1595 @quotation
1596 @strong{Please Note:} The @code{compress} program may be covered by a patent,
1597 and therefore we recommend you stop using it. We hope to have a
1598 different compress program in the future. We may change the name of
1599 this option at that time.
1600 @end quotation
1601
1602 @table @samp
1603 @item --compress
1604 @itemx --uncompress
1605 @itemx -z
1606 @itemx -Z
1607 When this option is specified, @code{tar} will compress (when writing
1608 an archive), or uncompress (when reading an archive). Used in
1609 conjunction with the @samp{--create}, @samp{--extract}, @samp{--list} and
1610 @samp{--compare} operations.
1611
1612 @item --compress-block
1613 @itemx -z -z
1614 Acts like @samp{--compress}, but pads the archive out to the next block
1615 boundary as it is written when used in conjunction with the
1616 @samp{--create} operation.
1617 @end table
1618
1619 @c >>> MIB -- why not use -Z instead of -z -z ? -ringo
1620
1621 @node Reading and Writing, Insuring Accuracy, Archive Structure, Top
1622 @chapter Reading and Writing Archives
1623
1624 The @samp{--create} operation writes a new archive, and the
1625 @samp{--extract} operation reads files from an archive and writes them
1626 into the file system. You can use other @code{tar} operations to
1627 write new information into an existing archive (adding files to it,
1628 adding another archive to it, or deleting files from it), and you can
1629 read a list of the files in an archive without extracting it using the
1630 @samp{--list} operation.
1631
1632 @menu
1633 * Archive Name:: The name of an archive
1634 * Creating in Detail:: Creating in detail
1635 * Modifying:: Modifying archives
1636 * Listing Contents:: Listing the contents of an archive
1637 * Extracting From Archives:: Extracting files from an archive
1638 @end menu
1639
1640 @node Archive Name, Creating in Detail, Reading and Writing, Reading and Writing
1641 @section The Name of an Archive
1642 @cindex Naming an archive
1643 @cindex Archive Name
1644 @cindex Directing output
1645 @cindex Where is the archive?
1646
1647 An archive can be saved as a file in the file system, sent through a
1648 pipe or over a network, or written to an I/O device such as a tape or
1649 disk drive. To specify the name of the archive, use the
1650 @samp{--file=@var{archive-name}} option.
1651
1652 An archive name can be the name of an ordinary file or the name of an
1653 I/O device. @code{tar} always needs an archive name---if you do not
1654 specify an archive name, the archive name comes from the environment
1655 variable @code{TAPE} or, if that variable is not specified, a default
1656 archive name, which is usually the name of tape unit zero (ie.
1657 /dev/tu00).
1658
1659 If you use @file{-} as an @var{archive-name}, @code{tar} reads the
1660 archive from standard input (when listing or extracting files), or
1661 writes it to standard output (when creating an archive). If you use
1662 @file{-} as an @var{archive-name} when modifying an archive,
1663 @code{tar} reads the original archive from its standard input and
1664 writes the entire new archive to its standard output.
1665
1666 @c >>> MIB--does standard input and output redirection work with all
1667 @c >>> operations?
1668 @c >>> need example for standard input and output (screen and keyboard?)
1669
1670 @cindex Standard input and output
1671 @cindex tar to standard input and output
1672
1673 To specify an archive file on a device attached to a remote machine,
1674 use the following:
1675
1676 @example
1677 --file=@var{hostname}:/@var{dev}/@var{file name}
1678 @end example
1679
1680 @noindent
1681 @code{tar} will complete the remote connection, if possible, and
1682 prompt you for a username and password. If you use
1683 @samp{--file=@@@var{hostname}:/@var{dev}/@var{file-name}}, @code{tar}
1684 will complete the remote connection, if possible, using your username
1685 as the username on the remote machine.
1686
1687 @c >>>MIB --- is this clear?
1688
1689 @table @samp
1690 @item --file=@var{archive-name}
1691 @itemx -f @var{archive-name}
1692 Names the archive to create or operate on. Use in conjunction with
1693 any operation.
1694 @end table
1695
1696 @node Creating in Detail, Modifying, Archive Name, Reading and Writing
1697 @section Creating in Detail
1698 @c operations should probably have examples, not tables.
1699 @cindex Writing new archives
1700 @cindex Archive creation
1701
1702 To create an archive, use @samp{tar --create}. To name the archive,
1703 use @samp{--file=@var{archive-name}} in conjunction with the
1704 @samp{--create} operation (@pxref{Archive Name}). If you do not name
1705 the archive, @code{tar} uses the value of the environment variable
1706 @code{TAPE} as the file name for the archive, or, if that is not
1707 available, @code{tar} uses a default archive name, usually that for tape
1708 unit zero. @xref{Archive Name}, for more information about specifying
1709 an archive name.
1710
1711 The following example creates an archive named @file{stooges},
1712 containing the files @file{larry}, @file{moe} and @file{curley}:
1713
1714 @example
1715 tar --create --file=stooges larry moe curley
1716 @end example
1717
1718 If you specify a directory name as a file-name argument, @code{tar}
1719 will archive all the files in that directory. The following example
1720 creates an archive named @file{hail/hail/fredonia}, containing the
1721 contents of the directory @file{marx}:
1722
1723 @example
1724 tar --create --file=hail/hail/fredonia marx
1725 @end example
1726
1727 If you don't specify files to put in the archive, @code{tar} archives
1728 all the files in the working directory. The following example creates
1729 an archive named @file{home} containing all the files in the working
1730 directory:
1731
1732 @example
1733 tar --create --file=home
1734 @end example
1735
1736 @xref{File Name Lists}, for other ways to specify files to archive.
1737
1738 Note: In the example above, an archive containing all the files in the
1739 working directory is being written to the working directory. GNU
1740 @code{tar} stores files in the working directory in an archive which
1741 is itself in the working directory without falling into an infinite
1742 loop. Other versions of @code{tar} may fall into this trap.
1743
1744 @node Modifying, Listing Contents, Creating in Detail, Reading and Writing
1745 @section Modifying Archives
1746 @cindex Modifying archives
1747
1748 Once an archive is created, you can add new archive members to it, add
1749 the contents of another archive, add newer versions of members already
1750 stored, or delete archive members already stored.
1751
1752 To find out what files are already stored in an archive, use @samp{tar
1753 --list --file=@var{archive-name}}. @xref{Listing Contents}.
1754
1755 @menu
1756 * Adding Files::
1757 * Appending Archives::
1758 * Deleting Archive Files:: Deleting Files From an Archive
1759 * Matching Format Parameters::
1760 @end menu
1761
1762 @node Adding Files, Appending Archives, Modifying, Modifying
1763 @subsection Adding Files to an Archive
1764 @cindex Adding files to an archive
1765 @cindex Updating an archive
1766
1767 To add files to an archive, use @samp{tar --add-file}. The archive to
1768 be added to must already exist and be in proper archive format (which
1769 normally means it was created previously using @code{tar}). If the
1770 archive was created with a different block size than now specified,
1771 @code{tar} will report an error (@pxref{Blocking Factor}). If the
1772 archive is not a valid @code{tar} archive, the results will be
1773 unpredictable. You cannot add files to a compressed archive, however
1774 you can add files to the last volume of a multi-volume archive.
1775 @xref{Matching Format Parameters}.
1776
1777 The following example adds the file @file{shemp} to the archive
1778 @file{stooges} created above:
1779
1780 @example
1781 tar --add-file --file=stooges shemp
1782 @end example
1783
1784 You must specify the files to be added; there is no default.
1785
1786 @samp{tar --update} acts like @samp{tar --add-file}, but does not add
1787 files to the archive if there is already a file entry with that name
1788 in the archive that has the same modification time.
1789
1790 Both @samp{--update} and @samp{--add-file} work by adding to the end of
1791 the archive. When you extract a file from the archive, only the
1792 version stored last will wind up in the file system. Because
1793 @samp{tar --extract} extracts files from an archive in sequence, and
1794 overwrites files with the same name in the file system, if a file name
1795 appears more than once in an archive the last version of the file will
1796 overwrite the previous versions which have just been extracted. You
1797 should avoid storing older versions of a file later in the archive.
1798
1799 Note: @samp{--update} is not suitable for performing backups, because
1800 it doesn't change directory content entries, and because it lengthens
1801 the archive every time it is used.
1802 @c <<< xref to scripted backup, listed incremental, for info on backups.
1803
1804 @node Appending Archives, Deleting Archive Files, Adding Files, Modifying
1805 @subsection Appending One Archive's Contents to Another Archive
1806 @cindex Adding archives to an archive
1807 @cindex Concatenating Archives
1808
1809 To append copies of an archive or archives to the end of another
1810 archive, use @samp{tar --add-archive}. The source and target archives
1811 must already exist and have been created using compatable format
1812 parameters (@pxref{Matching Format Parameters}).
1813
1814 @code{tar} will stop reading an archive if it encounters an
1815 end-of-archive marker. The @code{cat} utility does not remove
1816 end-of-archive markers, and is therefore unsuitable for concatenating
1817 archives. @samp{tar --add-archive} removes the end-of-archive marker
1818 from the target archive before each new archive is appended.
1819 @c <<< xref ignore-zeros
1820
1821 You must specify the source archives using
1822 @samp{--file=@var{archive-name}} (@pxref{Archive Name}). If you do not
1823 specify the target archive , @code{tar} uses the value of the
1824 environment variable @code{TAPE}, or, if this has not been set, the
1825 default archive name.
1826
1827 The following example adds the contents of the archive
1828 @file{hail/hail/fredonia} to the archive @file{stooges} (both archives
1829 were created in examples above):
1830
1831 @example
1832 tar --add-archive --file=stooges hail/hail/fredonia
1833 @end example
1834
1835 If you need to retrieve files from an archive that was added to using
1836 the @code{cat} utility, use the @samp{--ignore-zeros} option
1837 (@pxref{Archive Reading Options}).
1838
1839 @node Deleting Archive Files, Matching Format Parameters, Appending Archives, Modifying
1840 @subsection Deleting Files From an Archive
1841 @cindex Deleting files from an archive
1842 @cindex Removing files from an archive
1843
1844 To delete archive members from an archive, use @samp{tar --delete}.
1845 You must specify the file names of the members to be deleted. All
1846 archive members with the specified file names will be removed from the
1847 archive.
1848
1849 The following example removes the file @file{curley} from the archive
1850 @file{stooges}:
1851
1852 @example
1853 tar --delete --file=stooges curley
1854 @end example
1855
1856 You can only use @samp{tar --delete} on an archive if the archive
1857 device allows you to write to any point on the media.
1858
1859 @quotation
1860 @strong{Warning:} Don't try to delete an archive member from a
1861 magnetic tape, lest you scramble the archive. There is no safe way
1862 (except by completely re-writing the archive) to delete files from
1863 most kinds of magnetic tape.
1864 @end quotation
1865
1866 @c <<< MIB -- how about automatic detection of archive media? give error
1867 @c <<< unless the archive device is either an ordinary file or different
1868 @c <<< input and output (--file=-).
1869
1870 @node Matching Format Parameters, , Deleting Archive Files, Modifying
1871 @subsection Matching the Format Parameters
1872
1873 Some format parameters must be taken into consideration when modifying
1874 an archive:
1875
1876 Compressed archives cannot be modified.
1877
1878 You have to specify the block size of the archive when modifying an
1879 archive with a non-default block size.
1880
1881 Multi-volume archives can be modified like any other archive. To add
1882 files to a multi-volume archive, you need to only mount the last
1883 volume of the archive media (and new volumes, if needed). For all
1884 other operations, you need to use the entire archive.
1885
1886 If a multi-volume archive was labeled using @samp{--label}
1887 (@pxref{Archive Label}) when it was created, @code{tar} will not
1888 automatically label volumes which are added later. To label
1889 subsequent volumes, specify @samp{--label=@var{archive-label}} again in
1890 conjunction with the @samp{--add-file}, @samp{--update} or
1891 @samp{--add-archive} operation.
1892 @cindex Labelling multi-volume archives
1893 @c <<< example
1894
1895 @c <<< xref somewhere, for more information about format parameters.
1896
1897 @node Listing Contents, Extracting From Archives, Modifying, Reading and Writing
1898 @section Listing the Contents of an Archive
1899 @cindex Names of the files in an archive
1900 @cindex Archive contents, list of
1901 @cindex Archive members, list of
1902
1903 @samp{tar --list} prints a list of the file names of the archive
1904 members on the standard output. If you specify @var{file-name}
1905 arguments on the command line (or using the @samp{--files-from} option,
1906 @pxref{File Name Lists}), only the files you specify will be listed,
1907 and only if they exist in the archive. Files not specified will be
1908 ignored, unless they are under a specific directory.
1909
1910 If you include the @samp{--verbose} option, @code{tar} prints an
1911 @samp{ls -l} type listing for the archive. @pxref{Additional
1912 Information}, for a description of the @samp{--verbose} option.
1913
1914 If the blocking factor of the archive differs from the default,
1915 @code{tar} reports this. @xref{Blocking Factor}.
1916
1917 @xref{Archive Reading Options} for a list of options which can be used
1918 to modify @samp{--list}'s operation.
1919
1920 This example prints a list of the archive members of the archive
1921 @file{stooges}:
1922
1923 @example
1924 tar --list --file=stooges
1925 @end example
1926
1927 @noindent
1928 @code{tar} responds:
1929
1930 @example
1931 larry
1932 moe
1933 shemp
1934 marx/julius
1935 marx/alexander
1936 marx/karl
1937 @end example
1938
1939 This example generates a verbose list of the archive members of the
1940 archive file @file{dwarves}, which has a blocking factor of two:
1941
1942 @example
1943 tar --list -v --file=blocks
1944 @end example
1945
1946 @noindent
1947 @code{tar} responds:
1948
1949 @example
1950 tar: Blocksize = 2 records
1951 -rw------- ringo/user 42 May 1 13:29 1990 .bashful
1952 -rw-rw-rw- ringo/user 42 Oct 4 13:29 1990 doc
1953 -rw-rw-rw- ringo/user 42 Jul 20 18:01 1969 dopey
1954 -rw-rw---- ringo/user 42 Nov 26 13:42 1963 grumpy
1955 -rw-rw-rw- ringo/user 42 May 5 13:29 1990 happy
1956 -rw-rw-rw- ringo/user 42 May 1 12:00 1868 sleepy
1957 -rw-rw-rw- ringo/user 42 Jul 4 17:29 1776 sneezy
1958 @end example
1959
1960 @node Extracting From Archives, , Listing Contents, Reading and Writing
1961 @section Extracting Files from an Archive
1962 @cindex Extraction
1963 @cindex Retrieving files from an archive
1964 @cindex Resurrecting files from an archive
1965
1966 To read archive members from the archive and write them into the file
1967 system, use @samp{tar --extract}. The archive itself is left
1968 unchanged.
1969
1970 If you do not specify the files to extract, @code{tar} extracts all
1971 the files in the archive. If you specify the name of a directory as a
1972 file-name argument, @code{tar} will extract all files which have been
1973 stored as part of that directory. If a file was stored with a
1974 directory name as part of its file name, and that directory does not
1975 exist under the working directory when the file is extracted,
1976 @code{tar} will create the directory. @xref{Selecting Archive
1977 Members}, for information on specifying files to extract.
1978
1979 The following example shows the extraction of the archive
1980 @file{stooges} into an empty directory:
1981
1982 @example
1983 tar --extract --file=stooges
1984 @end example
1985
1986 @noindent
1987 Generating a listing of the directory (@samp{ls}) produces:
1988
1989 @example
1990 larry
1991 moe
1992 shemp
1993 marx
1994 @end example
1995
1996 @noindent
1997 The subdirectory @file{marx} contains the files @file{julius},
1998 @file{alexander} and @file{karl}.
1999
2000 If you wanted to just extract the files in the subdirectory
2001 @file{marx}, you could specify that directory as a file-name argument
2002 in conjunction with the @samp{--extract} operation:
2003
2004 @example
2005 tar --extract --file=stooges marx
2006 @end example
2007
2008 @quotation
2009 @strong{Warning:} Extraction can overwrite files in the file system.
2010 To avoid losing files in the file system when extracting files from
2011 the archive with the same name, use the @samp{--keep-old-files} option
2012 (@pxref{File Writing Options}).
2013 @end quotation
2014
2015 If the archive was created using @samp{--block-size}, @samp{--compress}
2016 or @samp{--multi-volume}, you must specify those format options again
2017 when extracting files from the archive (@pxref{Format Variations}).
2018
2019 @menu
2020 * Archive Reading Options::
2021 * File Writing Options::
2022 * Scarce Disk Space:: Recovering From Scarce Disk Space
2023 @end menu
2024
2025 @node Archive Reading Options, File Writing Options, Extracting From Archives, Extracting From Archives
2026 @subsection Options to Help Read Archives
2027 @cindex Options when reading archives
2028 @cindex Reading incomplete blocks
2029 @cindex Blocks, incomplete
2030 @cindex End of archive markers, ignoring
2031 @cindex Ignoring end of archive markers
2032 @cindex Large lists of file names on small machines
2033 @cindex Small memory
2034 @cindex Running out of space
2035
2036 @c <<< each option wants its own node. summary after menu
2037
2038 Normally, @code{tar} will request data in full block increments from
2039 an archive storage device. If the device cannot return a full block,
2040 @code{tar} will report an error. However, some devices do not always
2041 return full blocks, or do not require the last block of an archive to
2042 be padded out to the next block boundary. To keep reading until you
2043 obtain a full block, or to accept an incomplete block if it contains
2044 an end-of-archive marker, specify the @samp{--read-full-blocks} option
2045 in conjunction with the @samp{--extract} or @samp{--list} operations.
2046 @xref{Listing Contents}.
2047
2048 The @samp{--read-full-blocks} option is turned on by default when
2049 @code{tar} reads an archive from standard input, or from a remote
2050 machine. This is because on BSD Unix systems, attempting to read a
2051 pipe returns however much happens to be in the pipe, even if it is
2052 less than was requested. If this option were not enabled, @code{tar}
2053 would fail as soon as it read an incomplete block from the pipe.
2054
2055 If you're not sure of the blocking factor of an archive, you can read
2056 the archive by specifying @samp{--read-full-blocks} and
2057 @samp{--block-size=@var{n}}, where @var{n} is a blocking factor larger
2058 than the blocking factor of the archive. This lets you avoid having
2059 to determine the blocking factor of an archive. @xref{Blocking
2060 Factor}.
2061
2062 @table @samp
2063 @item --read-full-blocks
2064 @item -B
2065 Use in conjunction with @samp{tar --extract} to read an archive which
2066 contains incomplete blocks, or one which has a blocking factor less
2067 than the one specified.
2068 @end table
2069
2070 Normally @code{tar} stops reading when it encounters a block of zeros
2071 between file entries (which usually indicates the end of the archive).
2072 @samp{--ignore-zeros} allows @code{tar} to completely read an archive
2073 which contains a block of zeros before the end (i.e.@: a damaged
2074 archive, or one which was created by @code{cat}-ing several archives
2075 together).
2076
2077 The @samp{--ignore-zeros} option is turned off by default because many
2078 versions of @code{tar} write garbage after the end of archive entry,
2079 since that part of the media is never supposed to be read. GNU
2080 @code{tar} does not write after the end of an archive, but seeks to
2081 maintain compatablity among archiving utilities.
2082
2083 @table @samp
2084 @item --ignore-zeros
2085 @itemx -i
2086 To ignore blocks of zeros (ie.@: end-of-archive entries) which may be
2087 encountered while reading an archive. Use in conjunction with
2088 @samp{tar --extract} or @samp{tar --list}.
2089 @end table
2090
2091 If you are using a machine with a small amount of memory, and you need
2092 to process large list of file-names, you can reduce the amount of
2093 space @code{tar} needs to process the list. To do so, specify the
2094 @samp{--same-order} option and provide an ordered list of file names.
2095 This option tells @code{tar} that the @file{file-name} arguments
2096 (provided on the command line, or read from a file using the
2097 @samp{--files-from} option) are listed in the same order as the files
2098 in the archive.
2099
2100 You can create a file containing an ordered list of files in the
2101 archive by storing the output produced by @samp{tar --list
2102 --file=@var{archive-name}}. @xref{Listing Contents}, for information
2103 on the @samp{--list} operation.
2104
2105 This option is probably never needed on modern computer systems.
2106
2107 @table @samp
2108 @item --same-order
2109 @itemx --preserve-order
2110 @itemx -s
2111 To process large lists of file-names on machines with small amounts of
2112 memory. Use in conjunction with @samp{tar --compare}, @samp{tar --list}
2113 or @samp{tar --extract}.
2114 @end table
2115
2116 @c we don't need/want --preserve to exist any more
2117
2118 @node File Writing Options, Scarce Disk Space, Archive Reading Options, Extracting From Archives
2119 @subsection Changing How @code{tar} Writes Files
2120 @c <<< find a better title
2121 @cindex Overwriting old files, prevention
2122 @cindex Protecting old files
2123 @cindex Modification times of extracted files
2124 @cindex Permissions of extracted files
2125 @cindex Modes of extracted files
2126 @cindex Writing extracted files to standard output
2127 @cindex Standard output, writing extracted files to
2128
2129 Normally, @code{tar} writes extracted files into the file system
2130 without regard to the files already on the system---files with the
2131 same name as archive members are overwritten. To prevent @code{tar}
2132 from extracting an archive member from an archive, if doing so will
2133 overwrite a file in the file system, use @samp{--keep-old-files} in
2134 conjunction with the @samp{--extract} operation. When this option is
2135 specified, @code{tar} reports an error stating the name of the files
2136 in conflict, instead of writing the file from the archive.
2137
2138 @table @samp
2139 @item --keep-old files
2140 @itemx -k
2141 Prevents @code{tar} from overwriting files in the file system during
2142 extraction.
2143 @end table
2144
2145 Normally, @code{tar} sets the modification times of extracted files to
2146 the modification times recorded for the files in the archive, but
2147 limits the permissions of extracted files by the current @code{umask}
2148 setting.
2149
2150 To set the modification times of extracted files to the time when
2151 the files were extracted, use the @samp{--modification-time} option in
2152 conjunction with @samp{tar --extract}.
2153
2154 @table @samp
2155 @item --modification-time
2156 @itemx -m
2157 Sets the modification time of extracted archive members to the time
2158 they were extracted, not the time recorded for them in the archive.
2159 Use in conjunction with @samp{--extract}.
2160 @end table
2161
2162 To set the modes (access permissions) of extracted files to those
2163 recorded for those files in the archive, use the
2164 @samp{--preserve-permissions} option in conjunction with the
2165 @samp{--extract} operation.
2166 @c <<<mib --- should be aliased to ignore-umask.
2167
2168 @table @samp
2169 @item --preserve-permission
2170 @itemx --same-permission
2171 @itemx --ignore-umask
2172 @itemx -p
2173 Set modes of extracted archive members to those recorded in the
2174 archive, instead of current umask settings. Use in conjunction with
2175 @samp{--extract}.
2176 @end table
2177
2178 @c <<< following paragraph needs to be rewritten:
2179 @c <<< why doesnt' this cat files together, why is this useful. is it
2180 @c <<< really useful with more than one file?
2181 To write the files extracted to the standard output, instead of
2182 creating the files on the file system, use @samp{--to-stdout} in
2183 conjunction with @samp{tar --extract}. This option is useful if you
2184 are extracting files to send them through a pipe, and do not need to
2185 preserve them in the file system.
2186
2187 @table @samp
2188 @item --to-stdout
2189 @itemx -O
2190 Writes files to the standard output. Used in conjunction with
2191 @samp{--extract}.
2192 @end table
2193
2194 @c <<< why would you want to do such a thing, how are files separated on
2195 @c <<< the standard output? is this useful with more that one file? are
2196 @c <<< pipes the real reason?
2197
2198 @node Scarce Disk Space, , File Writing Options, Extracting From Archives
2199 @subsection Recovering From Scarce Disk Space
2200 @cindex Middle of the archive, starting in the
2201 @cindex Running out of space during extraction
2202 @cindex Disk space, running out of
2203 @cindex Space on the disk, recovering from lack of
2204
2205 If a previous attempt to extract files failed due to lack of disk
2206 space, you can use @samp{--starting-file=@var{file-name}} to start
2207 extracting only after file @var{file-name} when extracting files from
2208 the archive. This assumes, of course, that there is now free space,
2209 or that you are now extracting into a different file system.
2210
2211 @table @samp
2212 @item --starting-file=@var{file-name}
2213 @itemx -K @var{file-name}
2214 Starts an operation in the middle of an archive. Use in conjunction
2215 with @samp{--extract} or @samp{--list}.
2216 @end table
2217
2218 If you notice you are running out of disk space during an extraction
2219 operation, you can also suspend @code{tar}, remove unnecessary files
2220 from the file system, and then restart the same @code{tar} operation.
2221 In this case, @samp{--starting-file} is not necessary.
2222
2223 @c <<< xref incremental, xref --interactive, xref --exclude
2224
2225 @node Insuring Accuracy, Selecting Archive Members, Reading and Writing, Top
2226 @chapter Insuring the Accuracy of an Archive
2227
2228 You can insure the accuracy of an archive by comparing files in the
2229 system with archive members. @code{tar} can compare an archive to the
2230 file system as the archive is being written, to verify a write
2231 operation, or can compare a previously written archive, to insure that
2232 it is up to date.
2233
2234 @menu
2235 * Write Verification::
2236 * Comparing::
2237 @end menu
2238
2239 @node Write Verification, Comparing, Insuring Accuracy, Insuring Accuracy
2240 @section Verifying Data as It is Stored
2241 @cindex Verifying a write operation
2242 @cindex Double-checking a write operation
2243
2244 To check for discrepancies in an archive immediately after it is
2245 written, use the @samp{--verify} option in conjunction with the
2246 @samp{tar --create} operation. When this option is specified,
2247 @code{tar} checks archive members against their counterparts in the file
2248 system, and reports discrepancies on the standard error. In
2249 multi-volume archives, each volume is verified after it is written,
2250 before the next volume is written.
2251
2252 To verify an archive, you must be able to read it from before the end
2253 of the last written entry. This option is useful for detecting data
2254 errors on some tapes. Archives written to pipes, some cartridge tape
2255 drives, and some other devices cannot be verified.
2256
2257 @table @samp
2258 @item --verify
2259 @itemx -W
2260 Checks for discrepancies in the archive immediately after it is
2261 written. Use in conjunction with @samp{tar --create}.
2262 @end table
2263
2264 @node Comparing, , Write Verification, Insuring Accuracy
2265 @section Comparing an Archive with the File System
2266 @cindex Verifying the currency of an archive
2267
2268 @samp{tar --compare} compares archive members in an existing archive
2269 with their counterparts in the file system, and reports differences in
2270 file size, mode, owner, modification date and contents. If a file is
2271 represented in the archive but does not exist in the file system,
2272 @code{tar} reports a difference.
2273
2274 If you use @var{file-name} arguments in conjunction with @samp{tar
2275 --compare}, @code{tar} compares the archived versions of the files
2276 specified with their counterparts in the file system. If you specify
2277 a file that is not in the archive, @code{tar} will report an error. If
2278 you don't specify any files, @code{tar} compares all the files in the
2279 archive.
2280
2281 Because @code{tar} only checks files in the archive against files in
2282 the file system, and not vice versa, it ignores files in the file
2283 system that do not exist in the archive.
2284
2285 The following example compares the archive members @file{larry},
2286 @file{moe} and @file{curly} in the archive @file{stooges} with files
2287 of the same name in the file system.
2288
2289 @example
2290 tar --compare --file=stooges larry moe curly
2291 @end example
2292
2293 @noindent
2294 If a file, for example @file{curly}, did not exist in the archive,
2295 @code{tar} would report an error, as follows:
2296
2297 @example
2298 curly: does not exist
2299 @end example
2300
2301 @node Selecting Archive Members, User Interaction, Insuring Accuracy, Top
2302 @chapter Selecting Archive Members
2303 @cindex Specifying files to act on
2304 @cindex Specifying archive members
2305
2306 @dfn{File-name arguments} specify which files in the file system
2307 @code{tar} operates on, when creating or adding to an archive, or
2308 which archive members @code{tar} operates on, when reading or
2309 deleting from an archive. (@pxref{Reading and Writing}.)
2310
2311 To specify file names, you can include them as the last arguments on
2312 the command line, as follows:
2313 @example
2314 tar @var{operation} [@var{option1} @var{option2} ..] [@var{file-name-1} @var{file-name-2} ...]
2315 @end example
2316
2317 If you specify a directory name as a file name argument, all the files
2318 in that directory are operated on by @code{tar}.
2319
2320 If you do not specify files when @code{tar} is invoked, @code{tar}
2321 operates on all the non-directory files in the working directory (if
2322 the operation is @samp{--create}), all the archive members in the
2323 archive (if a read operation is specified), or does nothing (if any
2324 other operation is specified).
2325
2326 @menu
2327 * File Name Lists:: Reading File Names from a File
2328 * File Name Interpretation:: this needs a better title
2329 * File Exclusion:: so does this
2330 @end menu
2331
2332 @node File Name Lists, File Name Interpretation, Selecting Archive Members, Selecting Archive Members
2333 @section Reading a List of File Names from a File
2334 @cindex Lists of file names
2335 @cindex File-name arguments, alternatives
2336
2337 To read file names from a file on the file system, instead of from the
2338 command line, use the @samp{--files-from=@var{file}} option. If you
2339 specify @samp{-} as @var{file}, the file names are read from standard
2340 input. Note that using both @samp{--files-from=-} and @samp{--file=-}
2341 in the same command will not work unless the operation is
2342 @samp{--create}. @xref{Archive Name}, for an explanation of the
2343 @samp{--file} option.
2344
2345 @table @samp
2346 @item --files-from=@var{file}
2347 @itemx -T @var{file}
2348 Reads file-name arguments from a file on the file system, instead of
2349 from the command line. Use in conjunction with any operation.
2350 @end table
2351
2352 @node File Name Interpretation, File Exclusion, File Name Lists, Selecting Archive Members
2353 @section File Name Interpretation
2354 @cindex File Names, interpreting
2355
2356 @c <<<<add some text -ringo
2357
2358 @menu
2359 * Absolute File Names::
2360 * Changing Working Directory::
2361 * Archiving with Symbolic Links:: Archiving Using Symbolic Links
2362 @end menu
2363
2364 @node Absolute File Names, Changing Working Directory, File Name Interpretation, File Name Interpretation
2365 @subsection Storing and Extracting Files Relative to Root
2366
2367 @c <<< is this what this does, or does it just preserve the slash?
2368 @c <<< is it still called --absolute-paths?
2369
2370 @c To archive or extract files relative to the root directory, specify
2371 @c the @samp{--absolute-paths} option.
2372
2373 @c Normally, @code{tar} acts on files relative to the working
2374 @c directory---ignoring superior directory names when archiving, and
2375 @c ignoring leading slashes when extracting.
2376
2377 @c When you specify @samp{--absolute-paths}, @code{tar} stores file names
2378 @c including all superior directory names, and preserves leading slashes.
2379 @c If you only invoked @code{tar} from the root directory you would never
2380 @c need the @samp{--absolute-paths} option, but using this option may be
2381 @c more convenient than switching to root.
2382
2383 @c >>> should be an example in the tutorial/wizardry section using this
2384 @c >>> to transfer files between systems.
2385
2386 @c >>> is write access an issue?
2387
2388 @table @samp
2389 @item --absolute-paths
2390 Preserves full file names (inclusing superior dirctory names) when
2391 archiving files. Preserves leading slash when extracting files.
2392 @end table
2393
2394 @node Changing Working Directory, Archiving with Symbolic Links, Absolute File Names, File Name Interpretation
2395 @subsection Changing the Working Directory Within a List of File-names
2396 @cindex Directory, changing in mid-stream
2397 @cindex Working directory, specifying
2398
2399 To change working directory in the middle of a list of file names,
2400 (either on the command line or in a file specified using
2401 @samp{--files-from}), use @samp{--directory=@var{directory}}. This will
2402 change the working directory to the directory @var{directory} after
2403 that point in the list. For example,
2404
2405 @example
2406 tar --create iggy ziggy --directory=baz melvin
2407 @end example
2408
2409 @noindent
2410 will place the files @file{iggy} and @file{ziggy} from the current
2411 directory into the archive, followed by the file @file{melvin} from
2412 the directory @file{baz}. This option is especially useful when you
2413 have several widely separated files that you want to store in the same
2414 directory in the archive.
2415
2416 Note that the file @file{melvin} is recorded in the archive under the
2417 precise name @file{melvin}, @emph{not} @file{baz/melvin}. Thus, the
2418 archive will contain three files that all appear to have come from the
2419 same directory; if the archive is extracted with plain @samp{tar
2420 --extract}, all three files will be written in the current directory.
2421
2422 Contrast this with the command
2423
2424 @example
2425 tar -c iggy ziggy bar/melvin
2426 @end example
2427
2428 @noindent
2429 which records the third file in the archive under the name
2430 @file{bar/melvin} so that, if the archive is extracted using @samp{tar
2431 --extract}, the third file will be written in a subdirectory named
2432 @file{bar}.
2433
2434 @table @samp
2435 @item --directory=@file{directory}
2436 @itemx -C @file{directory}
2437 Changes the working directory.
2438 @end table
2439
2440 @c <<<need to test how extract deals with this, and add an example -ringo
2441
2442 @node Archiving with Symbolic Links, , Changing Working Directory, File Name Interpretation
2443 @subsection Archiving Using Symbolic Links
2444 @cindex File names, using symbolic links
2445 @cindex Symbolic link as file name
2446
2447 @samp{--dereference} is used with @samp{tar --create}, and causes
2448 @code{tar} to archive files which are referenced by a symbolic link,
2449 using the name of the link as the file name.
2450
2451 <<<this needs to be checked by MIB and then re-written, with an example
2452 The name under which the file is stored in the file system is not
2453 recorded in the archive. To record both the symbolic link name and
2454 the file name in the system, archive the file under both names. If
2455 all links were recorded automatically by @code{tar}, an extracted file
2456 might be linked to a file name that no longer exists in the file
2457 system.
2458
2459 @c <<< is the following still true? - ringo
2460 If a linked-to file is encountered again by @code{tar} while creating
2461 the same archive, an entire second copy of it will be stored. This
2462 could be considered a bug.
2463
2464 @table @samp
2465 @item --dereference
2466 @itemx -h
2467 Stores files referenced by a symbolic link, using the name of the link
2468 as the file name. Use in conjunction with any write operation.
2469 @end table
2470
2471 @node File Exclusion, , File Name Interpretation, Selecting Archive Members
2472 @section Selecting Files by Characteristic
2473 @cindex File names, excluding files by
2474 @cindex Excluding files by name and pattern
2475 @cindex Excluding files by file system
2476 @cindex File system boundaries, not crossing
2477 @cindex Excluding file by age
2478 @cindex Modification time, excluding files by
2479 @cindex Age, excluding files by
2480
2481 To avoid crossing file system boundaries when archiving parts of a
2482 directory tree, use @samp{--one-file-system}. This option only affects
2483 files that are archived because they are in a directory that is being
2484 archived; files explicitly named on the command line are archived
2485 regardless of where they reside.
2486
2487 This option is useful for making full or incremental archival backups
2488 of a file system.
2489
2490 If this option is used in conjunction with @samp{--verbose}, files that
2491 are excluded are mentioned by name on the standard error.
2492
2493 @table @samp
2494 @item --one-file-system
2495 @itemx -l
2496 Prevents @code{tar} from crossing file system boundaries when
2497 archiving. Use in conjunction with any write operation.
2498 @end table
2499
2500 To avoid operating on files whose names match a particular pattern,
2501 use the @samp{--exclude=@var{pattern}} or
2502 @samp{--exclude-from=@var{file}} options.
2503
2504 When you specify the @samp{--exclude=@var{pattern}} option, @code{tar}
2505 ignores files which match the @var{pattern}, which can be a single
2506 file name or a more complex expression. Thus, if you invoke
2507 @code{tar} with @samp{tar --create --exclude=*.o}, no files whose names
2508 end in @file{.o} are included in the archive.
2509 @c <<< what other things can you use besides "*"?
2510
2511 @samp{--exclude-from=@var{file}} acts like @samp{--exclude}, but
2512 specifies a file @var{file} containing a list of patterns. @code{tar}
2513 ignores files with names that fit any of these patterns.
2514
2515 You can use either option more than once in a single command.
2516
2517 @table @samp
2518 @item --exclude=@var{pattern}
2519 Causes @code{tar} to ignore files that match the @var{pattern}.
2520
2521 @item --exclude-from=@var{file}
2522 Causes @code{tar} to ignore files that match the patterns listed in
2523 @var{file}.
2524 @end table
2525 @c --exclude-from used to be "--exclude", --exclude didn't used to exist.
2526
2527 To operate only on files with modification or status-change times
2528 after a particular date, use @samp{--after-date=@var{date}}. You can
2529 use this option with @samp{tar --create} or @samp{tar --add-file} to
2530 insure only new files are archived, or with @samp{tar --extract} to
2531 insure only recent files are resurrected. @refill
2532 @c --after-date @var{date} or --newer @var{date}
2533
2534 @samp{--newer-mtime=@var{date}} acts like @samp{--after-date=@var{date}},
2535 but tests just the modification times of the files, ignoring
2536 status-change times.
2537
2538 @c <<<need example of --newer-mtime with quoted argument
2539 Remember that the entire date argument should be quoted if it contains
2540 any spaces.
2541
2542
2543 @strong{Please Note:} @samp{--after-date} and @samp{--newer-mtime}
2544 should not be used for incremental backups. Some files (such as those
2545 in renamed directories) are not selected up properly by these options.
2546 @c xref to incremental backup chapter when node name is decided.
2547
2548 @table @samp
2549 @item --after-date=@var{date}
2550 @itemx --newer=@var{date}
2551 @itemx -N @var{date}
2552 Acts on files only if their modification or inode-changed times are
2553 later than @var{date}. Use in conjunction with any operation.
2554 @item --newer-mtime=@var{date}
2555 Acts like @samp{--after-date}, but only looks at modification times.
2556 @end table
2557
2558 @c <<< following is the getdate date format --- needs to be re-written,
2559 @c <<< made a sub-node:
2560
2561 Time/Date Formats Accepted by getdate
2562 (omitting obscure constructions)
2563
2564 The input consists of one or more of: time zone day date year
2565 in any order.
2566
2567 Those in turn consist of (`|' and `/' mean `or', `[]' means `optional'):
2568
2569 time: H am/pm | H:M [am/pm] | H:M:S [am/pm]
2570 zone: timezone-name | timezone-name dst
2571 day: day-name | day-name, | N day-name
2572 date: M/D | M/D/Y | month-name D | month-name D, Y | D month-name | D month-name Y
2573 year: Y
2574
2575 am can also be a.m., pm can also be p.m.
2576 case and spaces around punctuation are not significant.
2577 month and day names can be abbreviated. >>>
2578
2579 @node User Interaction, Backups and Restoration, Selecting Archive Members, Top
2580 @chapter User Interaction
2581 @cindex Getting more information during the operation
2582 @cindex Information during operation
2583 @cindex Feedback from @code{tar}
2584
2585 Once you have typed a @code{tar}command, it is usually performed
2586 without any further information required of the user, or provided by
2587 @code{tar}. The following options allow you to generate progress and
2588 status information during an operation, or to confirm operations on
2589 files as they are performed.
2590
2591 @menu
2592 * Additional Information::
2593 * Interactive Operation::
2594 @end menu
2595
2596 @node Additional Information, Interactive Operation, User Interaction, User Interaction
2597 @section Progress and Status Information
2598 @cindex Progress information
2599 @cindex Status information
2600 @cindex Information on progress and status of operations
2601 @cindex Verbose operation
2602 @cindex Record number where error occured
2603 @cindex Error message, record number of
2604 @cindex Version of the @code{tar} program
2605
2606 Typically, @code{tar} performs most operations without reporting any
2607 information to the user except error messages. If you have
2608 encountered a problem when operating on an archive, however, you may
2609 need more information than just an error message in order to solve the
2610 problem. The following options can be helpful diagnostic tools.
2611
2612 When used with most operations, @samp{--verbose} causes @code{tar} to
2613 print the file names of the files or archive members it is operating
2614 on. When used with @samp{tar --list}, the verbose option causes
2615 @code{tar} to print out an @samp{ls -l} type listing of the files in
2616 the archive.
2617
2618 Verbose output appears on the standard output except when an archive
2619 is being written to the standard output (as with @samp{tar --create
2620 --file=- --verbose}). In that case @code{tar} writes verbose output to
2621 the standard error stream.
2622
2623 @table @samp
2624 @item --verbose
2625 @itemx -v
2626 Prints the names of files or archive members as they are being
2627 operated on. Can be used in conjunction with any operation. When
2628 used with @samp{--list}, generates an @samp{ls -l} type listing.
2629 @end table
2630
2631 To find out where in an archive a message was triggered, use
2632 @samp{--record-number}. @samp{--record-number} causes @code{tar} to
2633 print, along with every message it produces, the record number within
2634 the archive where the message was triggered.
2635
2636 This option is especially useful when reading damaged archives, since
2637 it helps pinpoint the damaged sections. It can also be used with
2638 @samp{tar --list} when listing a file-system backup tape, allowing you
2639 to choose among several backup tapes when retrieving a file later, in
2640 favor of the tape where the file appears earliest (closest to the
2641 front of the tape).
2642 @c <<< xref when the node name is set and the backup section written
2643
2644 @table @samp
2645 @item --record-number
2646 @itemx -R
2647 Prints the record number whenever a message is generated by
2648 @code{tar}. Use in conjunction with any operation.
2649 @end table
2650
2651 @c rewrite below
2652 To print the version number of the @code{tar} program, use @samp{tar
2653 --version}. @code{tar} prints the version number to the standard
2654 error. For example:
2655
2656 @example
2657 tar --version
2658 @end example
2659
2660 @noindent
2661 might return:
2662
2663 @example
2664 GNU tar version 1.09
2665 @end example
2666 @c used to be an option. has been fixed.
2667
2668 @node Interactive Operation, , Additional Information, User Interaction
2669 @section Asking for Confirmation During Operations
2670 @cindex Interactive operation
2671
2672 Typically, @code{tar} carries out a command without stopping for
2673 further instructions. In some situations however, you
2674 may want to exclude some files and archive members from the operation
2675 (for instance if disk or storage space is tight). You can do this by
2676 excluding certain files automatically (@pxref{File Exclusion}), or by
2677 performing an operation interactively, using the @samp{--interactive}
2678 operation.
2679
2680 When the @samp{--interactive} option is specified, @code{tar} asks for
2681 confirmation before reading, writing, or deleting each file it
2682 encounters while carrying out an operation. To confirm the action you
2683 must type a line of input beginning with @samp{y}. If your input line
2684 begins with anything other than @samp{y}, @code{tar} skips that file.
2685
2686 Commands which might be useful to perform interactively include
2687 appending files to an archive, extracting files from an archive,
2688 deleting a file from an archive, and deleting a file from disk during
2689 an incremental restore.
2690
2691 If @code{tar} is reading the archive from the standard input,
2692 @code{tar} opens the file @file{/dev/tty} to support the interactive
2693 communications.
2694 <<< this aborts if you won't OK the working directory. this is a bug. -ringo
2695
2696 @table @samp
2697 @item --interactive
2698 @itemx --confirmation
2699 @itemx -w
2700 Asks for confirmation before reading, writing or deleting an archive
2701 member (when listing, comparing or writing an archive or deleting
2702 archive members), or before writing or deleting a file (when
2703 extracting an archive).
2704 @end table
2705
2706 @node Backups and Restoration, Media, User Interaction, Top
2707 @chapter Performing Backups and Restoring Files
2708
2709 To @dfn{back up} a file system means to create archives that contain
2710 all the files in that file system. Those archives can then be used to
2711 restore any or all of those files (for instance if a disk crashes or a
2712 file is accidently deleted). File system @dfn{backups} are also
2713 called @dfn{dumps}.
2714
2715 @menu
2716 * Backup Levels:: Levels of backups
2717 * Backup Scripts:: Using scripts to perform backups
2718 and restoration
2719 * incremental and listed-incremental:: The --incremental
2720 and --listed-incremental Options
2721 * Problems:: Some common problems and their solutions
2722 @end menu
2723
2724 @node Backup Levels, Backup Scripts, Backups and Restoration, Backups and Restoration
2725 @section Levels of Backups
2726
2727 An archive containing all the files in the file system is called a
2728 @dfn{full backup} or @dfn{full dump}. You could insure your data by
2729 creating a full dump every day. This strategy, however, would waste a
2730 substantial amount of archive media and user time, as unchanged files
2731 are daily re-archived.
2732
2733 It is more efficient to do a full dump only occasionally. To back up
2734 files between full dumps, you can a incremental dump. A @dfn{level
2735 one} dump archives all the files that have changed since the last full
2736 dump.
2737
2738 A typical dump strategy would be to perform a full dump once a week,
2739 and a level one dump once a day. This means some versions of files
2740 will in fact be archived more than once, but this dump strategy makes
2741 it possible to restore a file system to within one day of accuracy by
2742 only extracting two archives---the last weekly (full) dump and the
2743 last daily (level one) dump. The only information lost would be in
2744 files changed or created since the last daily backup. (Doing dumps
2745 more than once a day is usually not worth the trouble).
2746
2747 @node Backup Scripts, incremental and listed-incremental, Backup Levels, Backups and Restoration
2748 @section Using Scripts to Perform Backups and Restoration
2749
2750 GNU @code{tar} comes with scripts you can use to do full and level-one
2751 dumps. Using scripts (shell programs) to perform backups and
2752 restoration is a convenient and reliable alternative to typing out
2753 file name lists and @code{tar} commands by hand.
2754
2755 Before you use these scripts, you need to edit the file
2756 @file{backup-specs}, which specifies parameters used by the backup
2757 scripts and by the restore script. @xref{Script Syntax}.
2758 Once the backup parameters are set, you can perform backups or
2759 restoration by running the appropriate script.
2760
2761 The name of the restore script is @code{restore}. The names of the
2762 level one and full backup scripts are, respectively, @code{level-1} and
2763 @code{level-0}. The @code{level-0} script also exists under the name
2764 @code{weekly}, and the @code{level-1} under the name
2765 @code{daily}---these additional names can be changed according to your
2766 backup schedule. @xref{Scripted Restoration}, for more information
2767 on running the restoration script. @xref{Scripted Backups}, for more
2768 information on running the backup scripts.
2769
2770 @emph{Please Note:} The backup scripts and the restoration scripts are
2771 designed to be used together. While it is possible to restore files
2772 by hand from an archive which was created using a backup script, and
2773 to create an archive by hand which could then be extracted using the
2774 restore script, it is easier to use the scripts. @xref{incremental
2775 and listed-incremental}, before making such an attempt.
2776
2777 @c shorten node names
2778 @menu
2779 * Backup Parameters:: Setting parameters for backups and restoration
2780 * Scripted Backups:: Using the backup scripts
2781 * Scripted Restoration:: Using the restore script
2782 @end menu
2783
2784 @node Backup Parameters, Scripted Backups, Backup Scripts, Backup Scripts
2785 @subsection Setting Parameters for Backups and Restoration
2786
2787 The file @file{backup-specs} specifies backup parameters for the
2788 backup and restoration scripts provided with @code{tar}. You must
2789 edit @file{backup-specs} to fit your system configuration and schedule
2790 before using these scripts.
2791
2792 @c <<< This about backup scripts needs to be written:
2793 @c <<<BS is a shell script .... thus ... @file{backup-specs} is in shell
2794 @c script syntax. @xref{Script Syntax}, for an explanation of this
2795 @c syntax.
2796
2797 @c whats a parameter .... looked at by the backup scripts ... which will
2798 @c be expecting to find ... now syntax ... value is linked to lame ...
2799 @c @file{backup-specs} specifies the following parameters:
2800
2801
2802 @table @code
2803 @item ADMINISTRATOR
2804 The user name of the backup administrator.
2805
2806 @item BACKUP_HOUR
2807 The hour at which the backups are done. This can be a number from 0
2808 to 23, or the string @samp{now}.
2809
2810 @item TAPE_FILE
2811 The device @code{tar} writes the archive to. This device should be
2812 attached to the host on which the dump scripts are run.
2813 @c <<< examples for all ...
2814
2815 @item TAPE_STATUS
2816 The command to use to obtain the status of the archive device,
2817 including error count. On some tape drives there may not be such a
2818 command; in that case, simply use `TAPE_STATUS=false'.
2819
2820 @item BLOCKING
2821 The blocking factor @code{tar} will use when writing the dump archive.
2822 @xref{Blocking Factor}.
2823
2824 @item BACKUP_DIRS
2825 A list of file systems to be dumped. You can include any directory
2826 name in the list---subdirectories on that file system will be
2827 included, regardless of how they may look to other networked machines.
2828 Subdirectories on other file systems will be ignored.
2829
2830 The host name specifies which host to run @code{tar} on, and should
2831 normally be the host that actually contains the file system. However,
2832 the host machine must have GNU @code{tar} installed, and must be able
2833 to access the directory containing the backup scripts and their
2834 support files using the same file name that is used on the machine
2835 where the scripts are run (ie. what @code{pwd} will print when in that
2836 directory on that machine). If the host that contains the file system
2837 does not have this capability, you can specify another host as long as
2838 it can access the file system through NFS.
2839
2840 @item BACKUP_FILES
2841 A list of individual files to be dumped. These should be accessible
2842 from the machine on which the backup script is run.
2843 @c <<<same file name, be specific. through nfs ...
2844 @end table
2845
2846 @menu
2847 * backup-specs example:: An Example Text of @file{Backup-specs}
2848 * Script Syntax:: Syntax for @file{Backup-specs}
2849 @end menu
2850
2851 @node backup-specs example, Script Syntax, Backup Parameters, Backup Parameters
2852 @subsubsection An Example Text of @file{Backup-specs}
2853
2854 The following is the text of @file{backup-specs} as it appears at FSF:
2855
2856 @example
2857 # site-specific parameters for file system backup.
2858
2859 ADMINISTRATOR=friedman
2860 BACKUP_HOUR=1
2861 TAPE_FILE=/dev/nrsmt0
2862 TAPE_STATUS="mts -t $TAPE_FILE"
2863 BLOCKING=124
2864 BACKUP_DIRS="
2865 albert:/fs/fsf
2866 apple-gunkies:/gd
2867 albert:/fs/gd2
2868 albert:/fs/gp
2869 geech:/usr/jla
2870 churchy:/usr/roland
2871 albert:/
2872 albert:/usr
2873 apple-gunkies:/
2874 apple-gunkies:/usr
2875 gnu:/hack
2876 gnu:/u
2877 apple-gunkies:/com/mailer/gnu
2878 apple-gunkies:/com/archive/gnu"
2879
2880 BACKUP_FILES="/com/mailer/aliases /com/mailer/league*[a-z]"
2881
2882 @end example
2883
2884 @node Script Syntax, , backup-specs example, Backup Parameters
2885 @subsubsection Syntax for @file{Backup-specs}
2886
2887 @file{backup-specs} is in shell script syntax. The following
2888 conventions should be considered when editing the script:
2889 @c <<< "conventions?"
2890
2891 A quoted string is considered to be contiguous, even if it is on more
2892 than one line. Therefore, you cannot include commented-out lines
2893 within a multi-line quoted string. BACKUP_FILES and BACKUP_DIRS are
2894 the two most likely parameters to be multi-line.
2895
2896 A quoted string typically cannot contain wildcards. In
2897 @file{backup-specs}, however, the parameters BACKUP_DIRS and
2898 BACKUP_FILES can contain wildcards.
2899
2900 @node Scripted Backups, Scripted Restoration, Backup Parameters, Backup Scripts
2901 @subsection Using the Backup Scripts
2902
2903 The syntax for running a backup script is:
2904
2905 @example
2906 @file{script-name} [@var{time-to-be-run}]
2907 @end example
2908
2909 where @var{time-to-be-run} can be a specific system time, or can be
2910 @kbd{now}. If you do not specify a time, the script runs at the time
2911 specified in @file{backup-specs} (@pxref{Script Syntax}).
2912
2913 You should start a script with a tape or disk mounted. Once you start
2914 a script, it prompts you for new tapes or disks as it needs them.
2915 Media volumes don't have to correspond to archive files---a
2916 multi-volume archive can be started in the middle of a tape that
2917 already contains the end of another multi-volume archive. The
2918 @code{restore} script prompts for media by its archive volume, so to
2919 avoid an error message you should keep track of which tape (or disk)
2920 contains which volume of the archive. @xref{Scripted Restoration}.
2921
2922 @c <<<have file names changed? -ringo
2923 The backup scripts write two files on the file system. The first is a
2924 record file in @file{/etc/tar-backup/}, which is used by the scripts
2925 to store and retrieve information about which files were dumped. This
2926 file is not meant to be read by humans, and should not be deleted by
2927 them. @xref{incremental and listed-incremental}, for a more
2928 detailed explanation of this file.
2929
2930 The second file is a log file containing the names of the file systems
2931 and files dumped, what time the backup was made, and any error
2932 messages that were generated, as well as how much space was left in
2933 the media volume after the last volume of the archive was written.
2934 You should check this log file after every backup. The file name is
2935 @file{log-@var{mmm-ddd-yyyy}-level-1} or
2936 @file{log-@var{mmm-ddd-yyyy}-full}.
2937
2938 The script also prints the name of each system being dumped to the
2939 standard output.
2940 @c <<<the section on restore scripts is commented out.
2941 @c <<< a section on non-scripted testore mya be a good idea
2942 @ignore
2943 @node Scripted Restoration, , Scripted Backups, Backup Scripts
2944 @subsection Using the Restore Script
2945 @c subject to change as things develop
2946
2947 To restore files that were archived using a scripted backup, use the
2948 @code{restore} script. The syntax for the script is:
2949
2950
2951 where ##### are the file systems to restore from, and
2952 ##### is a regular expression which specifies which files to
2953 restore. If you specify --all, the script restores all the files
2954 in the file system.
2955
2956 You should start the restore script with the media containing the
2957 first volume of the archive mounted. The script will prompt for other
2958 volumes as they are needed. If the archive is on tape, you don't need
2959 to rewind the tape to to its beginning---if the tape head is
2960 positioned past the beginning of the archive, the script will rewind
2961 the tape as needed. @xref{Media}, for a discussion of tape
2962 positioning.
2963
2964 If you specify @samp{--all} as the @var{files} argument, the
2965 @code{restore} script extracts all the files in the archived file
2966 system into the active file system.
2967
2968 @quotation
2969 @strong{Warning:}The script will delete files from the active file
2970 system if they were not in the file system when the archive was made.
2971 @end quotation
2972
2973 @xref{incremental and listed-incremental}, for an explanation of how
2974 the script makes that determination.
2975 @c this may be an option, not a given
2976 @end ignore
2977
2978 @node incremental and listed-incremental, Problems, Backup Scripts, Backups and Restoration
2979 @section The @code{--incremental} and @code{--listed-incremental} Options
2980
2981 @samp{--incremental} is used in conjunction with @samp{--create},
2982 @samp{--extract} or @samp{--list} when backing up and restoring file
2983 systems. An archive cannot be extracted or listed with the
2984 @samp{--incremental} option specified unless it was created with the
2985 option specified. This option should only be used by a script, not by
2986 the user, and is usually disregarded in favor of
2987 @samp{--listed-incremental}, which is described below.
2988
2989 @samp{--incremental} in conjunction with @samp{--create} causes
2990 @code{tar} to write, at the beginning of the archive, an entry for
2991 each of the directories that will be archived. The entry for a
2992 directory includes a list of all the files in the directory at the
2993 time the archive was created and a flag for each file indicating
2994 whether or not the file is going to be put in the archive.
2995
2996 Note that this option causes @code{tar} to create a non-standard
2997 archive that may not be readable by non-GNU versions of the @code{tar}
2998 program.
2999
3000 @samp{--incremental} in conjunction with @samp{--extract} causes
3001 @code{tar} to read the lists of directory contents previously stored
3002 in the archive, @emph{delete} files in the file system that did not
3003 exist in their directories when the archive was created, and then
3004 extract the files in the archive.
3005
3006 This behavior is convenient when restoring a damaged file system from
3007 a succession of incremental backups: it restores the entire state of
3008 the file system to that which obtained when the backup was made. If
3009 @samp{--incremental} isn't specified, the file system will probably
3010 fill up with files that shouldn't exist any more.
3011
3012 @samp{--incremental} in conjunction with @samp{--list}, causes
3013 @code{tar} to print, for each directory in the archive, the list of
3014 files in that directory at the time the archive was created. This
3015 information is put out in a format that is not easy for humans to
3016 read, but which is unambiguous for a program: each file name is
3017 preceded by either a @samp{Y} if the file is present in the archive,
3018 an @samp{N} if the file is not included in the archive, or a @samp{D}
3019 if the file is a directory (and is included in the archive). Each
3020 file name is terminated by a null character. The last file is followed
3021 by an additional null and a newline to indicate the end of the data.
3022
3023 @samp{--listed-incremental}=@var{file} acts like @samp{--incremental},
3024 but when used in conjunction with @samp{--create} will also cause
3025 @code{tar} to use the file @var{file}, which contains information
3026 about the state of the file system at the time of the last backup, to
3027 decide which files to include in the archive being created. That file
3028 will then be updated by @code{tar}. If the file @var{file} does not
3029 exist when this option is specified, @code{tar} will create it, and
3030 include all appropriate files in the archive.
3031
3032 The file @var{file}, which is archive independent, contains the date
3033 it was last modified and a list of devices, inode numbers and
3034 directory names. @code{tar} will archive files with newer mod dates
3035 or inode change times, and directories with an unchanged inode number
3036 and device but a changed directory name. The file is updated after
3037 the files to be archived are determined, but before the new archive is
3038 actually created.
3039
3040 @c <<< this section needs to be written
3041 @node Problems, , incremental and listed-incremental, Backups and Restoration
3042 @section Some Common Problems and their Solutions
3043
3044 errors from system:
3045 permission denied
3046 no such file or directory
3047 not owner
3048
3049 errors from tar:
3050 directory checksum error
3051 header format error
3052
3053 errors from media/system:
3054 i/o error
3055 device busy
3056
3057 @node Media, Quick Reference, Backups and Restoration, Top
3058 @chapter Tapes and Other Archive Media
3059
3060 Archives are usually written on dismountable media---tape cartridges,
3061 mag tapes, or floppy disks.
3062
3063 The amount of data a tape or disk holds depends not only on its size,
3064 but also on how it is formatted. A 2400 foot long reel of mag tape
3065 holds 40 megabytes of data when formated at 1600 bits per inch. The
3066 physically smaller EXABYTE tape cartridge holds 2.3 gigabytes.
3067
3068 Magnetic media are re-usable---once the archive on a tape is no longer
3069 needed, the archive can be erased and the tape or disk used over.
3070 Media quality does deteriorate with use, however. Most tapes or disks
3071 should be disgarded when they begin to produce data errors. EXABYTE
3072 tape cartridges should be disgarded when they generate an @dfn{error
3073 count} (number of non-usable bits) of more than 10k.
3074
3075 Magnetic media are written and erased using magnetic fields, and
3076 should be protected from such fields to avoid damage to stored data.
3077 Sticking a floppy disk to a filing cabinet using a magnet is probably
3078 not a good idea.
3079
3080
3081 @menu
3082 * Write Protection:: Write Protection
3083 * Tape Positioning:: Tape Positions and Tape Marks
3084 @end menu
3085
3086 @node Write Protection, Tape Positioning, Media, Media
3087 @section Write Protection
3088
3089 All tapes and disks can be @dfn{write protected}, to protect data on
3090 them from being changed. Once an archive is written, you should write
3091 protect the media to prevent the archive from being accidently
3092 overwritten or deleted. (This will protect the archive from being
3093 changed with a tape or floppy drive---it will not protect it from
3094 magnet fields or other physical hazards).
3095
3096 The write protection device itself is usually an integral part of the
3097 physical media, and can be a two position (write enabled/write
3098 disabled) switch, a notch which can be popped out or covered, a ring
3099 which can be removed from the center of a tape reel, or some other
3100 changeable feature.
3101
3102 @node Tape Positioning, , Write Protection, Media
3103 @section Tape Positions and Tape Marks
3104
3105 Just as archives can store more than one file from the file system,
3106 tapes can store more than one archive file. To keep track of where
3107 archive files (or any other type of file stored on tape) begin and
3108 end, tape archive devices write magnetic @dfn{tape marks} on the
3109 archive media. Tape drives write one tape mark between files,
3110 two at the end of all the file entries.
3111
3112 If you think of data as a series of "0000"'s, and tape marks as "x"'s,
3113 a tape might look like the following:
3114
3115 @example
3116 0000x000000x00000x00x00000xx-------------------------
3117 @end example
3118
3119 Tape devices read and write tapes using a read/write @dfn{tape
3120 head}---a physical part of the device which can only access one point
3121 on the tape at a time. When you use @code{tar} to read or write
3122 archive data from a tape device, the device will begin reading or
3123 writing from wherever on the tape the tape head happens to be,
3124 regardless of which archive or what part of the archive the tape head
3125 is on. Before writing an archive, you should make sure that no data
3126 on the tape will be overwritten (unless it is no longer needed).
3127 Before reading an archive, you should make sure the tape head is at
3128 the beginning of the archive you want to read. (The @code{restore}
3129 script will find the archive automatically. @xref{Scripted
3130 Restoration}). @xref{mt}, for an explanation of the tape moving
3131 utility.
3132
3133 If you want to add new archive file entries to a tape, you should
3134 advance the tape to the end of the existing file entries, backspace
3135 over the last tape mark, and write the new archive file. If you were
3136 to add two archives to the example above, the tape might look like the
3137 following:
3138
3139 @example
3140 0000x000000x00000x00x00000x000x0000xx----------------
3141 @end example
3142
3143 @menu
3144 * mt:: The @code{mt} Utility
3145 @end menu
3146
3147 @node mt, , Tape Positioning, Tape Positioning
3148 @subsection The @code{mt} Utility
3149
3150 <<< is it true that this only works on non-block devices? should
3151 <<< explain the difference, xref to block-size (fixed or variable).
3152
3153 You can use the @code{mt} utility to advance or rewind a tape past a
3154 specified number of archive files on the tape. This will allow you to
3155 move to the beginning of an archive before extracting or reading it,
3156 or to the end of all the archives before writing a new one.
3157 @c why isn't there an "advance 'til you find two tape marks together"?
3158
3159 The syntax of the @code{mt} command is:
3160
3161 @example
3162 mt [-f @var{tapename}] @var{operation} [@var{number}]
3163 @end example
3164
3165 where @var{tapename} is the name of the tape device, @var{number} is
3166 the number of times an operation is performed (with a default of one),
3167 and @var{operation} is one of the following:
3168
3169 @table @code
3170 @item eof
3171 @itemx weof
3172 Writes @var{number} tape marks at the current position on the tape.
3173
3174
3175 @item fsf
3176 Moves tape position forward @var{number} files.
3177
3178
3179 @item bsf
3180 Moves tape position back @var{number} files.
3181
3182
3183 @item rewind
3184 Rewinds the tape. (Ignores @var{number}).
3185
3186
3187 @item offline
3188 @itemx rewoff1
3189 Rewinds the tape and takes the tape device off-line. (Ignores @var{number}).
3190
3191
3192 @item status
3193 Prints status information about the tape unit.
3194 @end table
3195 <<< is there a better way to frob the spacing on the list? -ringo
3196
3197 If you don't specify a @var{tapename}, @code{mt} uses the environment
3198 variable TAPE; if TAPE does not exist, @code{mt} uses the device
3199 @file{/dev/rmt12}.
3200
3201 @code{mt} returns a 0 exit status when the operation(s) were
3202 successful, 1 if the command was unrecognized, and 2 if an operation
3203 failed.
3204
3205 @c <<< new node on how to find an archive? -ringo
3206 If you use @code{tar --extract} with the
3207 @samp{--label=@var{archive-name}} option specified, @code{tar} will
3208 read an archive label (the tape head has to be positioned on it) and
3209 print an error if the archive label doesn't match the
3210 @var{archive-name} specified. @var{archive-name} can be any regular
3211 expression. If the labels match, @code{tar} extracts the archive.
3212 @xref{Archive Label}. @xref{Matching Format Parameters}.
3213 <<< fix cross references
3214
3215 @code{tar --list --label} will cause @code{tar} to print the label.
3216
3217 @c <<< MIB -- program to list all the labels on a tape?
3218
3219 @node Quick Reference, Data Format Details, Media, Top
3220 @appendix A Quick Reference Guide to @code{tar} Operations and Options
3221 @c put in proper form for appendix. (unnumbered?)
3222
3223 @menu
3224 * Operations:: A Table of Operations
3225 * Options:: Table of Options
3226 @end menu
3227
3228 @node Operations, Options, Quick Reference, Quick Reference
3229 @appendixsec A Table of Operations
3230 @c add xrefs, note synonyms
3231
3232 The operation argument to @code{tar} specifies which action you want to
3233 take.
3234
3235 @table @samp
3236 @item -A
3237 Adds copies of an archive or archives to the end of another archive.
3238
3239 @item -c
3240 Creates a new archive.
3241
3242 @item -d
3243 Compares files in the archive with their counterparts in the file
3244 system, and reports differences in file size, mode, owner,
3245 modification date and contents.
3246
3247 @item -r
3248 Adds files to the end of the archive.
3249
3250 @item -t
3251 Prints a list of the contents of the archive.
3252
3253 @item -x
3254 Reads files from the archive and writes them into the active file
3255 system.
3256
3257 @item -u
3258 Adds files to the end of the archive, but only if they are newer than
3259 their counterparts already in the archive, or if they do not already
3260 exist in the archive.
3261
3262 @item --add-archive
3263 Adds copies of an archive or archives to the end of another archive.
3264
3265 @item --add-file
3266 Adds files to the end of the archive.
3267
3268 @item --append
3269 Adds files to the end of the archive.
3270
3271 @item --catenate
3272 Adds copies of an archive or archives to the end of another archive.
3273
3274 @item --compare
3275 Compares files in the archive with their counterparts in the file
3276 system, and reports differences in file size, mode, owner,
3277 modification date and contents.
3278
3279 @item --concatenate
3280 Adds copies of an archive or archives to the end of another archive.
3281
3282 @item --create
3283 Creates a new archive.
3284
3285 @item --delete
3286 Deletes files from the archive. All versions of the files are deleted.
3287
3288 @item --diff
3289 Compares files in the archive with their counterparts in the file
3290 system, and reports differences in file size, mode, owner,
3291 modification date and contents.
3292
3293 @item --extract
3294 Reads files from the archive and writes them into the active file
3295 system.
3296
3297 @item --get
3298 Reads files from the archive and writes them into the active file
3299 system.
3300
3301 @item --help
3302 Prints a list of @code{tar} operations and options.
3303
3304 @item --list
3305 Prints a list of the contents of the archive.
3306
3307 @item --update
3308 Adds files to the end of the archive, but only if they are newer than
3309 their counterparts already in the archive, or if they do not already
3310 exist in the archive.
3311
3312 @item --version
3313 Prints the version number of the @code{tar} program to the standard
3314 error.
3315 @end table
3316
3317 @node Options, , Operations, Quick Reference
3318 @appendixsec Table of Options
3319
3320 Options change the way @code{tar} performs an operation.
3321
3322 @table @samp
3323 @item --absolute-paths
3324 WILL BE INPUT WHEN QUESTION IS RESOLVED
3325
3326 @item --after-date=@var{date}
3327 Limit the operation to files changed after the given date.
3328 @xref{File Exclusion}.
3329
3330 @item --block-size=@var{number}
3331 Specify the blocking factor of an archive. @xref{Blocking Factor}.
3332
3333 @item --compress
3334 Specify a compressed archive. @xref{Compressed Archives}.
3335
3336 @item --compress-block.
3337 Create a whole block sized compressed archive. @xref{Compressed Archives}.
3338
3339 @item --confirmation
3340 Solicit confirmation for each file. @xref{Interactive Operation}
3341 <<< --selective should be a synonym.
3342
3343 @item --dereference
3344 Treat a symbolic link as an alternate name for the file the link
3345 points to. @xref{Symbolic Links}.
3346
3347 @item --directory=@file{directory}
3348 Change the working directory. @xref{Changing Working Directory}.
3349
3350 @item --exclude=@var{pattern}
3351 Exclude files which match the regular expression @var{pattern}.
3352 @xref{File Exclusion}.
3353
3354 @item --exclude-from=@file{file}
3355 Exclude files which match any of the regular expressions listed in
3356 the file @file{file}. @xref{File Exclusion}.
3357
3358 @item --file=@var{archive-name}
3359 Name the archive. @xref{Archive Name}).
3360
3361 @item --files-from=@file{file}
3362 Read file-name arguments from a file on the file system.
3363 @xref{File Name Lists}.
3364
3365 @item --ignore-umask
3366 Set modes of extracted files to those recorded in the archive.
3367 @xref{File Writing Options}.
3368
3369 @item --ignore-zeros
3370 Ignore end-of-archive entries. @xref{Archive Reading Options}.
3371 <<< this should be changed to --ignore-end
3372
3373 @item --listed-incremental=@var{file-name} (-g)
3374 Take a file name argument always. If the file doesn't exist, run a level
3375 zero dump, creating the file. If the file exists, uses that file to see
3376 what has changed.
3377
3378 @item --incremental (-G)
3379 @c <<<look it up>>>
3380
3381 @item --tape-length=@var{n} (-L)
3382 @c <<<alternate way of doing multi archive, will go to that length and
3383 @c prompts for new tape, automatically turns on multi-volume. >>>
3384 @c <<< this needs to be written into main body as well -ringo
3385
3386 @item --info-script=@var{program-file}
3387 Create a multi-volume archive via a script. @xref{Multi-Volume Archives}.
3388
3389 @item --interactive
3390 Ask for confirmation before performing any operation on a file or
3391 archive member.
3392
3393 @item --keep-old-files
3394 Prevent overwriting during extraction. @xref{File Writing Options}.
3395
3396 @item --label=@var{archive-label}
3397 Include an archive-label in the archive being created. @xref{Archive
3398 Label}.
3399
3400 @item --modification-time
3401 Set the modification time of extracted files to the time they were
3402 extracted. @xref{File Writing Options}.
3403
3404 @item --multi-volume
3405 Specify a multi-volume archive. @xref{Multi-Volume Archives}.
3406
3407 @item --newer=@var{date}
3408 Limit the operation to files changed after the given date.
3409 @xref{File Exclusion}.
3410
3411 @item --newer-mtime=@var{date}
3412 Limit the operation to files modified after the given date. @xref{File
3413 Exclusion}.
3414
3415 @item --old
3416 Create an old format archive. @xref{Old Style File Information}.
3417 @c <<< did we agree this should go away as a synonym?
3418
3419 @item --old-archive
3420 Create an old format archive. @xref{Old Style File Information}.
3421
3422 @item --one-file-system
3423 Prevent @code{tar} from crossing file system boundaries when
3424 archiving. @xref{File Exclusion}.
3425
3426 @item --portable
3427 Create an old format archive. @xref{Old Style File Information}.
3428 @c <<< was portability, may still need to be changed
3429
3430 @item --preserve-order
3431 Help process large lists of file-names on machines with small amounts of
3432 memory. @xref{Archive Reading Options}.
3433
3434 @item --preserve-permission
3435 Set modes of extracted files to those recorded in the archive.
3436 @xref{File Writing Options}.
3437
3438 @item --read-full-blocks
3439 Read an archive with a smaller than specified block size or which
3440 contains incomplete blocks. @xref{Archive Reading Options}).
3441 @c should be --partial-blocks (!!!)
3442
3443 @item --record-number
3444 Print the record number where a message is generated.
3445 @xref{Additional Information}.
3446
3447 @item --same-order
3448 Help process large lists of file-names on machines with small amounts of
3449 memory. @xref{Archive Reading Options}.
3450
3451 @item --same-permission
3452 Set the modes of extracted files to those recorded in the archive.
3453 @xref{File Writing Options}.
3454
3455 @item --sparse
3456 Archive sparse files sparsely. @xref{Sparse Files}.
3457
3458 @item --starting-file=@var{file-name}
3459 Begin reading in the middle of an archive. @xref{Scarce Disk Space}.
3460
3461 @item --to-stdout
3462 Write files to the standard output. @xref{File Writing Options}.
3463
3464 @item --uncompress
3465 Specifdo a compressed archive. @xref{Compressed Archives}.
3466
3467 @item -V @var{archive-label}
3468 Include an archive-label in the archive being created. @xref{Archive
3469 Label}.
3470 @c was --volume
3471
3472 @item --verbose
3473 Print the names of files or archive members as they are being
3474 operated on. @xref{Additional Information}.
3475
3476 @item --verify
3477 Check for discrepancies in the archive immediately after it is
3478 written. @xref{Write Verification}.
3479
3480 @item -B
3481 Read an archive with a smaller than specified block size or which
3482 contains incomplete blocks. @xref{Archive Reading Options}).
3483
3484 @item -K @var{file-name}
3485 Begin reading in the middle of an archive. @xref{Scarce Disk Space}.
3486
3487 @item -M
3488 Specify a multi-volume archive. @xref{Multi-Volume Archives}.
3489
3490 @item -N @var{date}
3491 Limit operation to files changed after the given date. @xref{File Exclusion}.
3492
3493 @item -O
3494 Write files to the standard output. @xref{File Writing Options}.
3495
3496 @c <<<<- P is absolute paths, add when resolved. -ringo>>>
3497
3498 @item -R
3499 Print the record number where a message is generated.
3500 @xref{Additional Information}.
3501
3502 @item -S
3503 Archive sparse files sparsely. @xref{Sparse Files}.
3504
3505 @item -T @var{file}
3506 Read file-name arguments from a file on the file system.
3507 @xref{File Name Lists}.
3508
3509 @item -W
3510 Check for discrepancies in the archive immediately after it is
3511 written. @xref{Write Verification}.
3512
3513 @item -Z
3514 Specify a compressed archive. @xref{Compressed Archives}.
3515
3516 @item -b @var{number}
3517 Specify the blocking factor of an archive. @xref{Blocking Factor}.
3518
3519 @item -f @var{archive-name}
3520 Name the archive. @xref{Archive Name}).
3521
3522 @item -h
3523 Treat a symbolic link as an alternate name for the file the link
3524 points to. @xref{Symbolic Links}.
3525
3526 @item -i
3527 Ignore end-of-archive entries. @xref{Archive Reading Options}.
3528
3529 @item -k
3530 Prevent overwriting during extraction. @xref{File Writing Options}.
3531
3532 @item -l
3533 Prevent @code{tar} from crossing file system boundaries when
3534 archiving. @xref{File Exclusion}.
3535
3536 @item -m
3537 Set the modification time of extracted files to the time they were
3538 extracted. @xref{File Writing Options}.
3539
3540 @item -o
3541 Create an old format archive. @xref{Old Style File Information}.
3542
3543 @item -p
3544 Set the modes of extracted files to those recorded in the archive.
3545 @xref{File Writing Options}.
3546
3547 @item -s
3548 Help process large lists of file-names on machines with small amounts of
3549 memory. @xref{Archive Reading Options}.
3550
3551 @item -v
3552 Print the names of files or archive members they are being operated
3553 on. @xref{Additional Information}.
3554
3555 @item -w
3556 @c <<<see --interactive. WILL BE INPUT WHEN QUESTIONS ARE RESOLVED.>>>
3557
3558 @item -z
3559 Specify a compressed archive. @xref{Compressed Archives}.
3560
3561 @item -z -z
3562 Create a whole block sized compressed archive. @xref{Compressed Archives}.
3563 @c I would rather this were -Z. it is the only double letter short
3564 @c form.
3565
3566 @item -C @file{directory}
3567 Change the working directory. @xref{Changing Working Directory}.
3568
3569 @item -F @var{program-file}
3570 Create a multi-volume archive via a script. @xref{Multi-Volume Archives}.
3571
3572 @item -X @file{file}
3573 Exclude files which match any of the regular expressions listed in
3574 the file @file{file}. @xref{File Exclusion}.
3575 @end table
3576
3577 @node Data Format Details, Concept Index, Quick Reference, Top
3578 @appendix Details of the Archive Data Format
3579
3580 This chapter is based heavily on John Gilmore's @i{tar}(5) manual page
3581 for the public domain @code{tar} that GNU @code{tar} is based on.
3582 @c it's been majorly edited since, we may be able to lose this.
3583
3584 The archive media contains a series of records, each of which contains
3585 512 bytes. Each archive member is represented by a header record,
3586 which describes the file, followed by zero or more records which
3587 represent the contents of the file. At the end of the archive file
3588 there may be a record consisting of a series of binary zeros, as an
3589 end-of-archive marker. GNU @code{tar} writes a record of zeros at the
3590 end of an archive, but does not assume that such a record exists when
3591 reading an archive.
3592
3593 Records may be grouped into @dfn{blocks} for I/O operations. A block
3594 of records is written with a single @code{write()} operation. The
3595 number of records in a block is specified using the @samp{--block-size}
3596 option. @xref{Blocking Factor}, for more information about specifying
3597 block size.
3598
3599 @menu
3600 * Header Data:: The Distribution of Data in the Header
3601 * Header Fields:: The Meaning of Header Fields
3602 * Sparse File Handling:: Fields to Handle Sparse Files
3603 @end menu
3604
3605 @node Header Data, Header Fields, Data Format Details, Data Format Details
3606 @appendixsec The Distribution of Data in the Header
3607
3608 The header record is defined in C as follows:
3609 @c I am taking the following code on faith.
3610
3611 @example
3612 @r{Standard Archive Format - Standard TAR - USTAR}
3613
3614 #define RECORDSIZE 512
3615 #define NAMSIZ 100
3616 #define TUNMLEN 32
3617 #define TGNMLEN 32
3618 #define SPARSE_EXT_HDR 21
3619 #define SPARSE_IN_HDR 4
3620
3621 struct sparse @{
3622 char offset[12];
3623 char numbytes[12];
3624 @};
3625
3626 union record @{
3627 char charptr[RECORDSIZE];
3628 struct header @{
3629 char name[NAMSIZ];
3630 char mode[8];
3631 char uid[8];
3632 char gid[8];
3633 char size[12];
3634 char mtime[12];
3635 char chksum[8];
3636 char linkflag;
3637 char linkname[NAMSIZ];
3638 char magic[8];
3639 char uname[TUNMLEN];
3640 char gname[TGNMLEN];
3641 char devmajor[8];
3642 char devminor[8];
3643
3644 @r{The following fields were added by gnu and are not used by other}
3645 @r{versions of @code{tar}}.
3646 char atime[12];
3647 char ctime[12];
3648 char offset[12];
3649 char longnames[4];
3650 @r{The next three fields were added by gnu to deal with shrinking down}
3651 @r{sparse files.}
3652 struct sparse sp[SPARSE_IN_HDR];
3653 char isextended;
3654 @r{This is the number of nulls at the end of the file, if any.}
3655 char ending_blanks[12];
3656
3657 @} header;
3658
3659 struct extended_header @{
3660 struct sparse sp[21];
3661 char isextended;
3662 @} ext_hdr;
3663
3664 @};
3665 @c <<< this whole thing needs to be put into better english
3666
3667 @r{The checksum field is filled with this while the checksum is computed.}
3668 #define CHKBLANKS " " @r{8 blanks, no null}
3669
3670 @r{Inclusion of this field marks an archive as being in standard}
3671 @r{Posix format (though GNU tar itself is not Posix conforming). GNU}
3672 @r{tar puts "ustar" in this field if uname and gname are valid.}
3673 #define TMAGIC "ustar " @r{7 chars and a null}
3674
3675 @r{The magic field is filled with this if this is a GNU format dump entry.}
3676 #define GNUMAGIC "GNUtar " @r{7 chars and a null}
3677
3678 @r{The linkflag defines the type of file.}
3679 #define LF_OLDNORMAL '\0' @r{Normal disk file, Unix compatible}
3680 #define LF_NORMAL '0' @r{Normal disk file}
3681 #define LF_LINK '1' @r{Link to previously dumped file}
3682 #define LF_SYMLINK '2' @r{Symbolic link}
3683 #define LF_CHR '3' @r{Character special file}
3684 #define LF_BLK '4' @r{Block special file}
3685 #define LF_DIR '5' @r{Directory}
3686 #define LF_FIFO '6' @r{FIFO special file}
3687 #define LF_CONTIG '7' @r{Contiguous file}
3688
3689 @r{hhe following are further link types which were defined later.}
3690
3691 @r{This is a dir entry that contains the names of files that were in}
3692 @r{the dir at the time the dump was made.}
3693 #define LF_DUMPDIR 'D'
3694
3695 @r{This is the continuation of a file that began on another volume}
3696 #define LF_MULTIVOL 'M'
3697
3698 @r{This is for sparse files}
3699 #define LF_SPARSE 'S'
3700
3701 @r{This file is a tape/volume header. Ignore it on extraction.}
3702 #define LF_VOLHDR 'V'
3703
3704 @r{These are bits used in the mode field - the values are in octal}
3705 #define TSUID 04000 @r{Set UID on execution}
3706 #define TSGID 02000 @r{Set GID on execution}
3707 #define TSVTX 01000 @r{Save text (sticky bit)}
3708
3709 @r{These are file permissions}
3710 #define TUREAD 00400 @r{read by owner}
3711 #define TUWRITE 00200 @r{write by owner}
3712 #define TUEXEC 00100 @r{execute/search by owner}
3713 #define TGREAD 00040 @r{read by group}
3714 #define TGWRITE 00020 @r{write by group}
3715 #define TGEXEC 00010 @r{execute/search by group}
3716 #define TOREAD 00004 @r{read by other}
3717 #define TOWRITE 00002 @r{write by other}
3718 #define TOEXEC 00001 @r{execute/search by other}
3719 @end example
3720
3721
3722 All characters in headers are 8-bit characters in the local variant of
3723 ASCII. Each field in the header is contiguous; that is, there is no
3724 padding in the header format.
3725
3726 Data representing the contents of files is not translated in any way
3727 and is not constrained to represent characters in any character set.
3728 @code{tar} does not distinguish between text files and binary files.
3729
3730 The @code{name}, @code{linkname}, @code{magic}, @code{uname}, and
3731 @code{gname} fields contain null-terminated character strings. All
3732 other fields contain zero-filled octal numbers in ASCII. Each numeric
3733 field of width @var{w} contains @var{w} @minus{} 2 digits, a space, and a
3734 null, except @code{size} and @code{mtime}, which do not contain the
3735 trailing null.
3736
3737 @node Header Fields, Sparse File Handling, Header Data, Data Format Details
3738 @appendixsec The Meaning of Header Fields
3739
3740 The @code{name} field contains the name of the file.
3741 <<< how big a name before field overflows?
3742
3743 The @code{mode} field contains nine bits which specify file
3744 permissions, and three bits which specify the Set UID, Set GID, and
3745 Save Text (``stick'') modes. Values for these bits are defined above.
3746 @xref{File Writing Options}, for information on how file permissions
3747 and modes are used by @code{tar}.
3748
3749 The @code{uid} and @code{gid} fields contain the numeric user and
3750 group IDs of the file owners. If the operating system does not
3751 support numeric user or group IDs, these fields should be ignored.
3752 @c but are they?
3753
3754 The @code{size} field contains the size of the file in bytes; this
3755 field contains a zero if the header describes a link to a file.
3756
3757 The @code{mtime} field contains the modification time of the file.
3758 This is the ASCII representation of the octal value of the last time
3759 the file was modified, represented as an integer number of seconds
3760 since January 1, 1970, 00:00 Coordinated Universal Time.
3761 @xref{File Writing Options}, for a description of how @code{tar} uses
3762 this information.
3763
3764 The @code{chksum} field contains the ASCII representation of the octal
3765 value of the simple sum of all bytes in the header record. To
3766 generate this sum, each 8-bit byte in the header is added to an
3767 unsigned integer, which has been initialized to zero. The precision
3768 of the integer is seventeen bits. When calculating the checksum, the
3769 @code{chksum} field itself is treated as blank.
3770
3771 The @code{atime} and @code{ctime} fields are used when making
3772 incremental backups; they store, respectively, the file's access time
3773 and last inode-change time.
3774
3775 The value in the @code{offset} field is used when making a
3776 multi-volume archive. The offset is number of bytes into the file
3777 that we need to go to pick up where we left off in the previous
3778 volume, i.e the location that a continued file is continued from.
3779
3780 The @code{longnames} field supports a feature that is not yet
3781 implemented. This field should be empty.
3782
3783 The @code{magic} field indicates that this archive was output in the
3784 P1003 archive format. If this field contains @code{TMAGIC}, the
3785 @code{uname} and @code{gname} fields will contain the ASCII
3786 representation of the owner and group of the file respectively. If
3787 found, the user and group IDs are used rather than the values in the
3788 @code{uid} and @code{gid} fields.
3789
3790 The @code{sp} field is used to archive sparse files efficiently.
3791 @xref{Sparse File Handling}, for a description of this field, and
3792 other fields it may imply.
3793
3794 The @code{typeflag} field specifies the file's type. If a particular
3795 implementation does not recognize or permit the specified type,
3796 @code{tar} extracts the file as if it were a regular file, and reports
3797 the discrepancy on the standard error. @xref{File Types}. @xref{GNU
3798 File Types}.
3799
3800 @menu
3801 * File Types:: File Types
3802 * GNU File Types:: Additional File Types Supported by GNU
3803 @end menu
3804
3805 @node File Types, GNU File Types, Header Fields, Header Fields
3806 @appendixsubsec File Types
3807
3808 The following flags are used to describe file types:
3809
3810 @table @code
3811 @item LF_NORMAL
3812 @itemx LF_OLDNORMAL
3813 Indicates a regular file. In order to be compatible with older
3814 versions of @code{tar}, a @code{typeflag} value of @code{LF_OLDNORMAL}
3815 should be silently recognized as a regular file. New archives should
3816 be created using @code{LF_NORMAL} for regular files. For backward
3817 compatibility, @code{tar} treats a regular file whose name ends with a
3818 slash as a directory.
3819
3820 @item LF_LINK
3821 Indicates a link to another file, of any type, which has been
3822 previously archived. @code{tar} identifies linked files in Unix by
3823 matching device and inode numbers. The linked-to name is specified in
3824 the @code{linkname} field with a trailing null.
3825
3826 @item LF_SYMLINK
3827 Indicates a symbolic link to another file. The linked-to
3828 name is specified in the @code{linkname} field with a trailing null.
3829 @xref{File Writing Options}, for information on archiving files
3830 referenced by a symbolic link.
3831
3832 @item LF_CHR
3833 @itemx LF_BLK
3834 Indicate character special files and block special files,
3835 respectively. In this case the @code{devmajor} and @code{devminor}
3836 fields will contain the major and minor device numbers. Operating
3837 systems may map the device specifications to their own local
3838 specification, or may ignore the entry.
3839
3840 @item LF_DIR
3841 Indicates a directory or sub-directory. The directory name in the
3842 @code{name} field should end with a slash. On systems where disk
3843 allocation is performed on a directory basis, the @code{size} field
3844 will contain the maximum number of bytes (which may be rounded to the
3845 nearest disk block allocation unit) that the directory can hold. A
3846 @code{size} field of zero indicates no size limitations. Systems that
3847 do not support size limiting in this manner should ignore the
3848 @code{size} field.
3849
3850 @item LF_FIFO
3851 Indicates a FIFO special file. Note that archiving a FIFO file
3852 archives the existence of the file and not its contents.
3853
3854 @item LF_CONTIG
3855 Indicates a contiguous file. Contiguous files are the same as normal
3856 files except that, in operating systems that support it, all the
3857 files' disk space is allocated contiguously. Operating systems which
3858 do not allow contiguous allocation should silently treat this type as
3859 a normal file.
3860
3861 @item 'A' @dots{}
3862 @itemx 'Z'
3863 These are reserved for custom implementations. Some of these are used
3864 in the GNU modified format, which is described below. @xref{GNU File
3865 Types}.
3866 @end table
3867
3868 Certain other flag values are reserved for specification in future
3869 revisions of the P1003 standard, and should not be used by any
3870 @code{tar} program.
3871
3872 @node GNU File Types, , File Types, Header Fields
3873 @appendixsubsec Additional File Types Supported by GNU
3874
3875 GNU @code{tar} uses additional file types to describe new types of
3876 files in an archive. These are listed below.
3877
3878 @table @code
3879 @item LF_DUMPDIR
3880 @itemx 'D'
3881 Indicates a directory and a list of files created by the
3882 @samp{--incremental} option. The @code{size} field gives the total
3883 size of the associated list of files. Each file name is preceded by
3884 either a @code{'Y'} (the file should be in this archive) or an
3885 @code{'N'} (the file is a directory, or is not stored in the archive).
3886 Each file name is terminated by a null. There is an additional null
3887 after the last file name.
3888
3889 @item LF_MULTIVOL
3890 @itemx 'M'
3891 Indicates a file continued from another volume of a multi-volume
3892 archive (@pxref{Multi-Volume Archives}). The original type of the file is not
3893 given here. The @code{size} field gives the maximum size of this
3894 piece of the file (assuming the volume does not end before the file is
3895 written out). The @code{offset} field gives the offset from the
3896 beginning of the file where this part of the file begins. Thus
3897 @code{size} plus @code{offset} should equal the original size of the
3898 file.
3899
3900 @item LF_SPARSE
3901 @itemx 'S'
3902 Indicates a sparse file. @xref{Sparse Files}. @xref{Sparse File
3903 Handling}.
3904
3905 @item LF_VOLHDR
3906 @itemx 'V'
3907 Marks an archive label that was created using the @samp{--label} option
3908 when the archive was created (@pxref{Archive Label}. The @code{name}
3909 field contains the argument to the option. The @code{size} field is
3910 zero. Only the first file in each volume of an archive should have
3911 this type.
3912 @end table
3913
3914 @node Sparse File Handling, , Header Fields, Data Format Details
3915 @appendixsec Fields to Handle Sparse Files
3916
3917 The following header information was added to deal with sparse files
3918 (@pxref{Sparse Files}):
3919
3920 @c TALK TO MIB
3921 The @code{sp} field (fields? something else?) is an array of
3922 @code{struct sparse}. Each @code{struct sparse} contains two
3923 12-character strings, which represent the offset into the file and the
3924 number of bytes to be written at that offset. The offset is absolute,
3925 and not relative to the offset in preceding array elements.
3926
3927 The header can contain four of these @code{struct sparse}; if more are
3928 needed, they are not stored in the header, instead, the flag
3929 @code{isextended} is set and the next record is an
3930 @code{extended_header}.
3931 @c @code{extended_header} or @dfn{extended_header} ??? the next
3932 @c record after the header, or in the middle of it.
3933
3934 The @code{isextended} flag is only set for sparse files, and then only
3935 if extended header records are needed when archiving the file.
3936
3937 Each extended header record can contain an array of 21 sparse
3938 structures, as well as another @code{isextended} flag. There is no
3939 limit (except that implied by the archive media) on the number of
3940 extended header records that can be used to describe a sparse file.
3941
3942 @c so is @code{extended_header} the right way to write this?
3943
3944 @node Concept Index, , Data Format Details, Top
3945 @unnumbered Concept Index
3946
3947 @printindex cp
3948
3949 @summarycontents
3950 @contents
3951 @bye
3952
3953
This page took 0.202334 seconds and 5 git commands to generate.