X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=doc%2Ftar.texi;h=9d1072d4befe44240ec128ad7568a278ced8133c;hb=5f19de037215499a77312a67261dfb7f8d1615a1;hp=0139bd92e6c66b2dd63fd556e2fa1775ddb1672d;hpb=07727fe74a14f6aaaa968fa5213541815fa109b1;p=chaz%2Ftar diff --git a/doc/tar.texi b/doc/tar.texi index 0139bd9..9d1072d 100644 --- a/doc/tar.texi +++ b/doc/tar.texi @@ -10,487 +10,8 @@ @smallbook @c %**end of header -@c ====================================================================== -@c This document has three levels of rendition: PUBLISH, DISTRIB or PROOF, -@c as decided by @set symbols. The PUBLISH rendition does not show -@c notes or marks asking for revision. Most users will prefer having more -@c information, even if this information is not fully revised for adequacy, -@c so DISTRIB is the default for tar distributions. The PROOF rendition -@c show all marks to the point of ugliness, but is nevertheless useful to -@c those working on the manual itself. -@c ====================================================================== - -@ifclear PUBLISH -@ifclear DISTRIB -@ifclear PROOF -@set DISTRIB -@end ifclear -@end ifclear -@end ifclear - -@ifset PUBLISH -@set RENDITION The book, version -@end ifset - -@ifset DISTRIB -@set RENDITION FTP release, version -@end ifset - -@ifset PROOF -@set RENDITION Proof reading version -@end ifset - -@c --------------------------------------------------------------------- -@c The @FIXME's, @UNREVISED and @c comments are part Fran@,{c}ois's work -@c plan. These annotations are somewhat precious to him; he asks that I -@c do not alter them inconsiderately. Much work is needed for GNU tar -@c internals (the sources, the programs themselves). Revising the -@c adequacy of the manual while revising the sources, and cleaning them -@c both at the same time, is a good way to proceed. -@c --------------------------------------------------------------------- - -@c Output marks for nodes needing revision, but not in PUBLISH rendition. - -@macro UNREVISED -@ifclear PUBLISH -@quotation -@emph{(This message will disappear, once this node revised.)} -@end quotation -@end ifclear -@end macro - -@c Output various FIXME information only in PROOF rendition. - -@macro FIXME{string} -@allow-recursion -@quote-arg -@ifset PROOF -@strong{} \string\ @strong{} -@end ifset - -@end macro - -@macro FIXME-ref{string} -@quote-arg -@ifset PROOF -@strong{} \string\ @strong{} -@end ifset - -@end macro - -@macro FIXME-pxref{string} -@quote-arg -@ifset PROOF -@strong{} \string\ @strong{} -@end ifset - -@end macro - -@macro FIXME-xref{string} -@quote-arg -@ifset PROOF -@strong{} \string\ @strong{} -@end ifset - -@end macro - -@c @macro option{entry} -@c @quote-arg -@c @opindex{--\entry\} -@c @value{\entry\} -@c @end macro - -@macro GNUTAR -@acronym{GNU} @command{tar} -@end macro - -@set op-absolute-names @kbd{--absolute-names} (@kbd{-P}) -@set ref-absolute-names @ref{absolute} -@set xref-absolute-names @xref{absolute} -@set pxref-absolute-names @pxref{absolute} - -@set op-after-date @kbd{--after-date=@var{date}} (@kbd{--newer=@var{date}}, @kbd{-N @var{date}}) -@set ref-after-date @ref{after} -@set xref-after-date @xref{after} -@set pxref-after-date @pxref{after} - -@set op-append @kbd{--append} (@kbd{-r}) -@set ref-append @ref{add} -@set xref-append @xref{add} -@set pxref-append @pxref{add} - -@set op-atime-preserve @kbd{--atime-preserve} -@set ref-atime-preserve @ref{Attributes} -@set xref-atime-preserve @xref{Attributes} -@set pxref-atime-preserve @pxref{Attributes} - -@set op-backup @kbd{--backup} -@set ref-backup @ref{Backup options} -@set xref-backup @xref{Backup options} -@set pxref-backup @pxref{Backup options} - -@set op-block-number @kbd{--block-number} (@kbd{-R}) -@set ref-block-number @ref{verbose} -@set xref-block-number @xref{verbose} -@set pxref-block-number @pxref{verbose} - -@set op-blocking-factor @kbd{--blocking-factor=@var{512-size}} (@kbd{-b @var{512-size}}) -@set ref-blocking-factor @ref{Blocking Factor} -@set xref-blocking-factor @xref{Blocking Factor} -@set pxref-blocking-factor @pxref{Blocking Factor} - -@set op-bzip2 @kbd{--bzip2} (@kbd{-j}) -@set ref-bzip2 @ref{gzip} -@set xref-bzip2 @xref{gzip} -@set pxref-bzip2 @pxref{gzip} - -@set op-check-links @kbd{--check-links} (@kbd{-l}) -@set ref-check-links @ref{--check-links} -@set xref-check-links @xref{--check-links} -@set pxref-check-links @pxref{--check-links} - -@set op-checkpoint @kbd{--checkpoint} -@set ref-checkpoint @ref{verbose} -@set xref-checkpoint @xref{verbose} -@set pxref-checkpoint @pxref{verbose} - -@set op-check-links @kbd{--check-links} - -@set op-compare @kbd{--compare} (@kbd{--diff}, @kbd{-d}) -@set ref-compare @ref{compare} -@set xref-compare @xref{compare} -@set pxref-compare @pxref{compare} - -@set op-compress @kbd{--compress} (@kbd{--uncompress}, @kbd{-Z}) -@set ref-compress @ref{gzip} -@set xref-compress @xref{gzip} -@set pxref-compress @pxref{gzip} - -@set op-concatenate @kbd{--concatenate} (@kbd{--catenate}, @kbd{-A}) -@set ref-concatenate @ref{concatenate} -@set xref-concatenate @xref{concatenate} -@set pxref-concatenate @pxref{concatenate} - -@set op-create @kbd{--create} (@kbd{-c}) -@set ref-create @ref{create} -@set xref-create @xref{create} -@set pxref-create @pxref{create} - -@set op-delete @kbd{--delete} -@set ref-delete @ref{delete} -@set xref-delete @xref{delete} -@set pxref-delete @pxref{delete} - -@set op-dereference @kbd{--dereference} (@kbd{-h}) -@set ref-dereference @ref{dereference} -@set xref-dereference @xref{dereference} -@set pxref-dereference @pxref{dereference} - -@set op-directory @kbd{--directory=@var{directory}} (@kbd{-C @var{directory}}) -@set ref-directory @ref{directory} -@set xref-directory @xref{directory} -@set pxref-directory @pxref{directory} - -@set op-exclude @kbd{--exclude=@var{pattern}} -@set ref-exclude @ref{exclude} -@set xref-exclude @xref{exclude} -@set pxref-exclude @pxref{exclude} - -@set op-exclude-from @kbd{--exclude-from=@var{file-of-patterns}} (@kbd{-X @var{file-of-patterns}}) -@set ref-exclude-from @ref{exclude} -@set xref-exclude-from @xref{exclude} -@set pxref-exclude-from @pxref{exclude} - -@set op-extract @kbd{--extract} (@kbd{--get}, @kbd{-x}) -@set ref-extract @ref{extract} -@set xref-extract @xref{extract} -@set pxref-extract @pxref{extract} - -@set op-file @kbd{--file=@var{archive-name}} (@kbd{-f @var{archive-name}}) -@set ref-file @ref{file} -@set xref-file @xref{file} -@set pxref-file @pxref{file} - -@set op-files-from @kbd{--files-from=@var{file-of-names}} (@kbd{-T @var{file-of-names}}) -@set ref-files-from @ref{files} -@set xref-files-from @xref{files} -@set pxref-files-from @pxref{files} - -@set op-force-local @kbd{--force-local} -@set ref-force-local @ref{file} -@set xref-force-local @xref{file} -@set pxref-force-local @pxref{file} - -@set op-group @kbd{--group=@var{group}} -@set ref-group @ref{Option Summary} -@set xref-group @xref{Option Summary} -@set pxref-group @pxref{Option Summary} - -@set op-gzip @kbd{--gzip} (@kbd{--gunzip}, @kbd{--ungzip}, @kbd{-z}) -@set ref-gzip @ref{gzip} -@set xref-gzip @xref{gzip} -@set pxref-gzip @pxref{gzip} - -@set op-help @kbd{--help} -@set ref-help @ref{help} -@set xref-help @xref{help} -@set pxref-help @pxref{help} - -@set op-ignore-failed-read @kbd{--ignore-failed-read} -@set ref-ignore-failed-read @ref{create options} -@set xref-ignore-failed-read @xref{create options} -@set pxref-ignore-failed-read @pxref{create options} - -@set op-ignore-zeros @kbd{--ignore-zeros} (@kbd{-i}) -@set ref-ignore-zeros @ref{Reading} -@set xref-ignore-zeros @xref{Reading} -@set pxref-ignore-zeros @pxref{Reading} - -@set op-incremental @kbd{--incremental} (@kbd{-G}) -@set ref-incremental @ref{Inc Dumps} -@set xref-incremental @xref{Inc Dumps} -@set pxref-incremental @pxref{Inc Dumps} - -@set op-info-script @kbd{--info-script=@var{script-name}} (@kbd{--new-volume-script=@var{script-name}}, @kbd{-F @var{script-name}}) -@set ref-info-script @ref{Multi-Volume Archives} -@set xref-info-script @xref{Multi-Volume Archives} -@set pxref-info-script @pxref{Multi-Volume Archives} - -@set op-interactive @kbd{--interactive} (@kbd{-w}) -@set ref-interactive @ref{interactive} -@set xref-interactive @xref{interactive} -@set pxref-interactive @pxref{interactive} - -@set op-keep-old-files @kbd{--keep-old-files} (@kbd{-k}) -@set ref-keep-old-files @ref{Keep Old Files} -@set xref-keep-old-files @xref{Keep Old Files} -@set pxref-keep-old-files @pxref{Keep Old Files} - -@set op-keep-newer-files @kbd{--keep-old-files} -@set ref-keep-newer-files @ref{Keep Newer Files} -@set xref-keep-newer-files @xref{Keep Newer Files} -@set pxref-keep-newer-files @pxref{Keep Newer Files} - -@set op-label @kbd{--label=@var{archive-label}} (@kbd{-V @var{archive-label}}) -@set ref-label @ref{label} -@set xref-label @xref{label} -@set pxref-label @pxref{label} - -@set op-list @kbd{--list} (@kbd{-t}) -@set ref-list @ref{list} -@set xref-list @xref{list} -@set pxref-list @pxref{list} - -@set op-listed-incremental @kbd{--listed-incremental=@var{snapshot-file}} (@kbd{-g @var{snapshot-file}}) -@set ref-listed-incremental @ref{Inc Dumps} -@set xref-listed-incremental @xref{Inc Dumps} -@set pxref-listed-incremental @pxref{Inc Dumps} - -@set op-mode @kbd{--mode=@var{permissions}} -@set ref-mode @ref{Option Summary} -@set xref-mode @xref{Option Summary} -@set pxref-mode @pxref{Option Summary} - -@set op-multi-volume @kbd{--multi-volume} (@kbd{-M}) -@set ref-multi-volume @ref{Multi-Volume Archives} -@set xref-multi-volume @xref{Multi-Volume Archives} -@set pxref-multi-volume @pxref{Multi-Volume Archives} - -@set op-newer-mtime @kbd{--newer-mtime=@var{date}} -@set ref-newer-mtime @ref{after} -@set xref-newer-mtime @xref{after} -@set pxref-newer-mtime @pxref{after} - -@set op-no-recursion @kbd{--no-recursion} -@set ref-no-recursion @ref{recurse} -@set xref-no-recursion @xref{recurse} -@set pxref-no-recursion @pxref{recurse} - -@set op-no-same-owner @kbd{--no-same-owner} (@kbd{-o}) -@set ref-no-same-owner @ref{Attributes} -@set xref-no-same-owner @xref{Attributes} -@set pxref-no-same-owner @pxref{Attributes} - -@set op-no-same-permissions @kbd{--no-same-permissions} -@set ref-no-same-permissions @ref{Attributes} -@set xref-no-same-permissions @xref{Attributes} -@set pxref-no-same-permissions @pxref{Attributes} - -@set op-null @kbd{--null} -@set ref-null @ref{files} -@set xref-null @xref{files} -@set pxref-null @pxref{files} - -@set op-numeric-owner @kbd{--numeric-owner} -@set ref-numeric-owner @ref{Attributes} -@set xref-numeric-owner @xref{Attributes} -@set pxref-numeric-owner @pxref{Attributes} - -@set op-occurrence @kbd{--occurrence} -@set ref-occurrence @ref{--occurrence} -@set xref-occurrence @xref{--occurrence} -@set pxref-occurrence @pxref{--occurrence} - -@set op-old-archive @kbd{--old-archive} (@kbd{-o}) -@set ref-old-archive @ref{old} -@set xref-old-archive @xref{old} -@set pxref-old-archive @pxref{old} - -@set op-one-file-system @kbd{--one-file-system} (@kbd{-l}) -@set ref-one-file-system @ref{one} -@set xref-one-file-system @xref{one} -@set pxref-one-file-system @pxref{one} - -@set op-overwrite @kbd{--overwrite} -@set ref-overwrite @ref{Overwrite Old Files} -@set xref-overwrite @xref{Overwrite Old Files} -@set pxref-overwrite @pxref{Overwrite Old Files} - -@set op-owner @kbd{--owner=@var{user}} -@set ref-owner @ref{Option Summary} -@set xref-owner @xref{Option Summary} -@set pxref-owner @pxref{Option Summary} - -@set op-format @kbd{--format} -@set ref-format @ref{format} -@set xref-format @xref{format} -@set pxref-format @pxref{format} - -@set op-format-v7 @kbd{--format=v7} -@set op-format-gnu @kbd{--format=gnu} -@set op-format-oldgnu @kbd{--format=oldgnu} -@set op-format-posix @kbd{--format=posix} -@set op-format-ustar @kbd{--format=ustar} - -@set op-posix @kbd{--posix} -@set ref-posix @ref{posix} -@set xref-posix @xref{posix} -@set pxref-posix @pxref{posix} - -@set op-preserve @kbd{--preserve} -@set ref-preserve @ref{Attributes} -@set xref-preserve @xref{Attributes} -@set pxref-preserve @pxref{Attributes} - -@set op-record-size @kbd{--record-size=@var{size}} -@set ref-record-size @ref{Blocking} -@set xref-record-size @xref{Blocking} -@set pxref-record-size @pxref{Blocking} - -@set op-recursive-unlink @kbd{--recursive-unlink} -@set ref-recursive-unlink @ref{Writing} -@set xref-recursive-unlink @xref{Writing} -@set pxref-recursive-unlink @pxref{Writing} - -@set op-read-full-records @kbd{--read-full-records} (@kbd{-B}) -@set ref-read-full-records @ref{Blocking} -@set xref-read-full-records @xref{Blocking} -@set pxref-read-full-records @pxref{Blocking} -@c FIXME: or should it be Reading, or Blocking Factor - -@set op-remove-files @kbd{--remove-files} -@set ref-remove-files @ref{Writing} -@set xref-remove-files @xref{Writing} -@set pxref-remove-files @pxref{Writing} - -@set op-rsh-command @kbd{rsh-command=@var{command}} - -@set op-same-order @kbd{--same-order} (@kbd{--preserve-order}, @kbd{-s}) -@set ref-same-order @ref{Scarce} -@set xref-same-order @xref{Scarce} -@set pxref-same-order @pxref{Scarce} -@c FIXME: or should it be Reading, or Attributes? - -@set op-same-owner @kbd{--same-owner} -@set ref-same-owner @ref{Attributes} -@set xref-same-owner @xref{Attributes} -@set pxref-same-owner @pxref{Attributes} - -@set op-same-permissions @kbd{--same-permissions} (@kbd{--preserve-permissions}, @kbd{-p}) -@set ref-same-permissions @ref{Attributes} -@set xref-same-permissions @xref{Attributes} -@set pxref-same-permissions @pxref{Attributes} -@c FIXME: or should it be Writing? - -@set op-show-omitted-dirs @kbd{--show-omitted-dirs} -@set ref-show-omitted-dirs @ref{verbose} -@set xref-show-omitted-dirs @xref{verbose} -@set pxref-show-omitted-dirs @pxref{verbose} - -@set op-sparse @kbd{--sparse} (@kbd{-S}) -@set ref-sparse @ref{sparse} -@set xref-sparse @xref{sparse} -@set pxref-sparse @pxref{sparse} - -@set op-starting-file @kbd{--starting-file=@var{name}} (@kbd{-K @var{name}}) -@set ref-starting-file @ref{Scarce} -@set xref-starting-file @xref{Scarce} -@set pxref-starting-file @pxref{Scarce} - -@set op-strip-path @kbd{--strip-path} -@set ref-strip-path @ref{--strip-path} -@set xref-strip-path @xref{--strip-path} -@set pxref-strip-path @pxref{--strip-path} - -@set op-suffix @kbd{--suffix=@var{suffix}} -@set ref-suffix @ref{Backup options} -@set xref-suffix @xref{Backup options} -@set pxref-suffix @pxref{Backup options} - -@set op-tape-length @kbd{--tape-length=@var{1024-size}} (@kbd{-L @var{1024-size}}) -@set ref-tape-length @ref{Using Multiple Tapes} -@set xref-tape-length @xref{Using Multiple Tapes} -@set pxref-tape-length @pxref{Using Multiple Tapes} - -@set op-to-stdout @kbd{--to-stdout} (@kbd{-O}) -@set ref-to-stdout @ref{Writing} -@set xref-to-stdout @xref{Writing} -@set pxref-to-stdout @pxref{Writing} - -@set op-totals @kbd{--totals} -@set ref-totals @ref{verbose} -@set xref-totals @xref{verbose} -@set pxref-totals @pxref{verbose} - -@set op-touch @kbd{--touch} (@kbd{-m}) -@set ref-touch @ref{Writing} -@set xref-touch @xref{Writing} -@set pxref-touch @pxref{Writing} - -@set op-unlink-first @kbd{--unlink-first} (@kbd{-U}) -@set ref-unlink-first @ref{Writing} -@set xref-unlink-first @xref{Writing} -@set pxref-unlink-first @pxref{Writing} - -@set op-update @kbd{--update} (@kbd{-u}) -@set ref-update @ref{update} -@set xref-update @xref{update} -@set pxref-update @pxref{update} - -@set op-use-compress-prog @kbd{--use-compress-prog=@var{program}} -@set ref-use-compress-prog @ref{gzip} -@set xref-use-compress-prog @xref{gzip} -@set pxref-use-compress-prog @pxref{gzip} - -@set op-verbose @kbd{--verbose} (@kbd{-v}) -@set ref-verbose @ref{verbose} -@set xref-verbose @xref{verbose} -@set pxref-verbose @pxref{verbose} - -@set op-verify @kbd{--verify} (@kbd{-W}) -@set ref-verify @ref{verify} -@set xref-verify @xref{verify} -@set pxref-verify @pxref{verify} - -@set op-version @kbd{--version} -@set ref-version @ref{help} -@set xref-version @xref{help} -@set pxref-version @pxref{help} - -@set op-volno-file @kbd{--volno-file=@var{file-of-number}} -@set ref-volno-file @ref{Using Multiple Tapes} -@set xref-volno-file @xref{Using Multiple Tapes} -@set pxref-volno-file @pxref{Using Multiple Tapes} +@include rendition.texi +@include value.texi @c Put everything in one index (arbitrarily chosen to be the concept index). @syncodeindex fn cp @@ -672,7 +193,7 @@ Advanced @GNUTAR{} Operations * delete:: * compare:: -How to Add Files to Existing Archives: @code{--append} +How to Add Files to Existing Archives: @option{--append} * appending files:: Appending Files to an Archive * multiple:: @@ -681,11 +202,11 @@ Updating an Archive * how to update:: -Options Used by @code{--create} +Options Used by @option{--create} * Ignore Failed Read:: -Options Used by @code{--extract} +Options Used by @option{--extract} * Reading:: Options to Help Read Archives * Writing:: Changing How @command{tar} Writes Files @@ -1051,7 +572,7 @@ synonym for @option{--no-same-owner}. @item Use of short option @option{-l} Earlier versions of @GNUTAR{} understood @option{-l} option as a -synonym for @samp{--one-file-system}. Such usage is deprecated. +synonym for @option{--one-file-system}. Such usage is deprecated. For compatibility with other implementations future versions of @GNUTAR{} will understand this option as a synonym for @option{--check-links}. @@ -1104,8 +625,9 @@ thing.} For version 1.12, Daniel Hagerty contributed a great deal of technical consulting. In particular, he is the primary author of @ref{Backups}. -In July, 2003 @GNUTAR{} was put on CVS at @url{savannah.gnu.org}, and -an active development and maintenance work has started +In July, 2003 @GNUTAR{} was put on CVS at savannah.gnu.org +(see @url{http://savannah.gnu.org/projects/tar}), and +active development and maintenance work has started again. Currently @GNUTAR{} is being maintained by Paul Eggert, Sergey Poznyakoff and Jeff Bailey. @@ -1128,7 +650,7 @@ manual}. @chapter Tutorial Introduction to @command{tar} This chapter guides you through some basic examples of three @command{tar} -operations: @samp{--create}, @samp{--list}, and @samp{--extract}. If +operations: @option{--create}, @option{--list}, and @option{--extract}. If you already know how to use some other version of @command{tar}, then you may not need to read this chapter. This chapter omits most complicated details about how @command{tar} works. @@ -1310,8 +832,8 @@ Extract one or more members from an archive. To understand how to run @command{tar} in the three operating modes listed previously, you also need to understand how to use two of the options to -@command{tar}: @samp{--file} (which takes an archive file as an argument) -and @samp{--verbose}. (You are usually not @emph{required} to specify +@command{tar}: @option{--file} (which takes an archive file as an argument) +and @option{--verbose}. (You are usually not @emph{required} to specify either of these options when you run @command{tar}, but they can be very useful in making things more clear and helping you avoid errors.) @@ -1322,7 +844,7 @@ useful in making things more clear and helping you avoid errors.) @end menu @node file tutorial -@unnumberedsubsec The @samp{--file} Option +@unnumberedsubsec The @option{--file} Option @table @kbd @item --file=@var{archive-name} @@ -1352,7 +874,7 @@ For more information on using the @value{op-file} option, see @ref{file}. @node verbose tutorial -@unnumberedsubsec The @samp{--verbose} Option +@unnumberedsubsec The @option{--verbose} Option @table @kbd @item --verbose @@ -1363,21 +885,21 @@ Show the files being worked on as @command{tar} is running. @value{op-verbose} shows details about the results of running @command{tar}. This can be especially useful when the results might not be obvious. For example, if you want to see the progress of @command{tar} as -it writes files into the archive, you can use the @samp{--verbose} +it writes files into the archive, you can use the @option{--verbose} option. In the beginning, you may find it useful to use -@samp{--verbose} at all times; when you are more accustomed to +@option{--verbose} at all times; when you are more accustomed to @command{tar}, you will likely want to use it at certain times but not at -others. We will use @samp{--verbose} at times to help make something +others. We will use @option{--verbose} at times to help make something clear, and we will give many examples both using and not using -@samp{--verbose} to show the differences. +@option{--verbose} to show the differences. -Sometimes, a single instance of @samp{--verbose} on the command line +Sometimes, a single instance of @option{--verbose} on the command line will show a full, @samp{ls} style listing of an archive or files, @c FIXME: Describe the exact output format, e.g., how hard links are displayed. giving sizes, owners, and similar information. Other times, -@samp{--verbose} will only show files or members that the particular +@option{--verbose} will only show files or members that the particular operation is operating on at the time. In the latter case, you can -use @samp{--verbose} twice in a command to get a listing such as that +use @option{--verbose} twice in a command to get a listing such as that in the former case. For example, instead of saying @smallexample @@ -1403,16 +925,16 @@ $ @kbd{tar --create --verbose --verbose @dots{}} @noindent Note that you must double the hyphens properly each time. -Later in the tutorial, we will give examples using @w{@samp{--verbose +Later in the tutorial, we will give examples using @w{@option{--verbose --verbose}}. @node help tutorial -@unnumberedsubsec Getting Help: Using the @code{--help} Option +@unnumberedsubsec Getting Help: Using the @option{--help} Option @table @kbd @item --help -The @samp{--help} option to @command{tar} prints out a very brief list of +The @option{--help} option to @command{tar} prints out a very brief list of all operations and option available for the current version of @command{tar} available on your system. @end table @@ -1423,7 +945,7 @@ all operations and option available for the current version of One of the basic operations of @command{tar} is @value{op-create}, which you use to create a @command{tar} archive. We will explain -@samp{--create} first because, in order to learn about the other +@option{--create} first because, in order to learn about the other operations, you will find it useful to have an archive available to practice on. @@ -1439,7 +961,7 @@ The three files you will archive in this example are called @file{blues}, @file{folk}, and @file{jazz}. The archive is called @file{collection.tar}. -This section will proceed slowly, detailing how to use @samp{--create} +This section will proceed slowly, detailing how to use @option{--create} in @code{verbose} mode, and showing examples using both short and long forms. In the rest of the tutorial, and in the examples in the next chapter, we will proceed at a slightly quicker pace. This section @@ -1522,12 +1044,12 @@ results you don't expect. For this reason, it is a good idea to get into the habit of typing options in the order that makes inherent sense. @xref{short create}, for more information on this. -In this example, you type the command as shown above: @samp{--create} +In this example, you type the command as shown above: @option{--create} is the operation which creates the new archive -(@file{collection.tar}), and @samp{--file} is the option which lets +(@file{collection.tar}), and @option{--file} is the option which lets you give it the name you chose. The files, @file{blues}, @file{folk}, and @file{jazz}, are now members of the archive, @file{collection.tar} -(they are @dfn{file name arguments} to the @samp{--create} operation). +(they are @dfn{file name arguments} to the @option{--create} operation). @FIXME{xref here to the discussion of file name args?}Now that they are in the archive, they are called @emph{archive members}, not files. (@pxref{Definitions,members}). @@ -1557,7 +1079,7 @@ an existing archive; it will delete the archive and write a new one. Use @value{op-append} instead. @xref{append}. @node create verbose -@subsection Running @samp{--create} with @samp{--verbose} +@subsection Running @option{--create} with @option{--verbose} If you include the @value{op-verbose} option on the command line, @command{tar} will list the files it is acting on as it is working. In @@ -1571,7 +1093,7 @@ jazz @end smallexample This example is just like the example we showed which did not use -@samp{--verbose}, except that @command{tar} generated the remaining lines +@option{--verbose}, except that @command{tar} generated the remaining lines @iftex (note the different font styles). @end iftex @@ -1620,14 +1142,14 @@ $ @kbd{tar -cfv collection.tar blues folk jazz} @noindent In this case, @command{tar} will make an archive file called @file{v}, containing the files @file{blues}, @file{folk}, and @file{jazz}, because -the @samp{v} is the closest ``file name'' to the @samp{-f} option, and +the @samp{v} is the closest ``file name'' to the @option{-f} option, and is thus taken to be the chosen archive file name. @command{tar} will try to add a file called @file{collection.tar} to the @file{v} archive file; if the file @file{collection.tar} did not already exist, @command{tar} will report an error indicating that this file does not exist. If the file @file{collection.tar} does already exist (e.g., from a previous command you may have run), then @command{tar} will add this file to the archive. -Because the @samp{-v} option did not get registered, @command{tar} will not +Because the @option{-v} option did not get registered, @command{tar} will not run under @samp{verbose} mode, and will not report its progress. The end result is that you may be quite confused about what happened, @@ -1650,7 +1172,7 @@ $ @kbd{tar blues -c folk -f collection.tar jazz} @noindent It would be very easy to put the wrong string of characters -immediately following the @samp{-f}, but doing that could sacrifice +immediately following the @option{-f}, but doing that could sacrifice valuable data. For this reason, we recommend that you pay very careful attention to @@ -1779,7 +1301,7 @@ baboon Be sure to use a @value{op-file} option just as with @value{op-create} to specify the name of the archive. -If you use the @value{op-verbose} option with @samp{--list}, then +If you use the @value{op-verbose} option with @option{--list}, then @command{tar} will print out a listing reminiscent of @w{@samp{ls -l}}, showing owner, file size, and so forth. @@ -1791,8 +1313,8 @@ $ @kbd{tar --list --verbose --file=collection.tar folk} -rw-rw-rw- myself user 62 1990-05-23 10:55 folk @end smallexample -@cindex File name arguments, using @code{--list} with -@cindex @code{--list} with file name arguments +@cindex File name arguments, using @option{--list} with +@cindex @option{--list} with file name arguments You can specify one or more individual member names as arguments when using @samp{list}. In this case, @command{tar} will only list the names of members you identify. For example, @w{@kbd{tar --list @@ -1814,7 +1336,7 @@ However, @w{@kbd{tar --list --file=collection.tar folk}} would respond with @file{folk}, because @file{folk} is in the archive file @file{collection.tar}. If you are not sure of the exact file name, try listing all the files in the archive and searching for the one you -expect to find; remember that if you use @samp{--list} with no file +expect to find; remember that if you use @option{--list} with no file names as arguments, @command{tar} will print the names of all the members stored in the specified archive. @@ -1866,7 +1388,7 @@ from an archive, use the @value{op-extract} operation. As with Extracting an archive does not modify the archive in any way; you can extract it multiple times if you want or need to. -Using @samp{--extract}, you can extract an entire archive, or specific +Using @option{--extract}, you can extract an entire archive, or specific files. The files can be directories containing other files, or not. As with @value{op-create} and @value{op-list}, you may use the short or the long form of the operation without affecting the performance. @@ -1973,7 +1495,7 @@ However, if a file was stored with a directory name as part of its file name, and that directory does not exist under the working directory when the file is extracted, @command{tar} will create the directory. -We can demonstrate how to use @samp{--extract} to extract a directory +We can demonstrate how to use @option{--extract} to extract a directory file with an example. Change to the @file{practice} directory if you weren't there, and remove the files @file{folk} and @file{jazz}. Then, go back to the parent directory and extract the archive @@ -2027,8 +1549,8 @@ $ @kbd{tar -xvf ../untrusted.tar} @end smallexample It is also a good practice to examine contents of the archive -before extracting it, using @option{op-list} option, possibly combined -with @option{op-verbose}. +before extracting it, using @value{op-list} option, possibly combined +with @value{op-verbose}. @node failing commands @subsection Commands That Will Fail @@ -2250,7 +1772,7 @@ separated by whitespace. A backslash escapes the next character, so it can be used to specify an option containing whitespace or a backslash. Note that @command{tar} options are case sensitive. For example, the -options @samp{-T} and @samp{-t} are different; the first requires an +options @option{-T} and @option{-t} are different; the first requires an argument for stating the name of a file providing a list of @var{name}s, while the second does not require an argument and is another way to write @value{op-list}. @@ -2307,12 +1829,12 @@ pay special attention to them. "mnemonic" with "long", or *ugh* vice versa.} Each option has at least one long (or mnemonic) name starting with two -dashes in a row, e.g.@: @samp{--list}. The long names are more clear than +dashes in a row, e.g.@: @option{--list}. The long names are more clear than their corresponding short or old names. It sometimes happens that a single mnemonic option has many different different names which are -synonymous, such as @samp{--compare} and @samp{--diff}. In addition, +synonymous, such as @option{--compare} and @option{--diff}. In addition, long option names can be given unique abbreviations. For example, -@samp{--cre} can be used in place of @samp{--create} because there is no +@option{--cre} can be used in place of @option{--create} because there is no other mnemonic option which begins with @samp{cre}. (One way to find this out is by trying it and seeing what happens; if a particular abbreviation could represent more than one option, @command{tar} will tell @@ -2338,22 +1860,22 @@ Mnemonic options which require arguments take those arguments immediately following the option name. There are two ways of specifying a mandatory argument. It can be separated from the option name either by an equal sign, or by any amount of -white space characters. For example, the @samp{--file} option (which +white space characters. For example, the @option{--file} option (which tells the name of the @command{tar} archive) is given a file such as @file{archive.tar} as argument by using any of the following notations: -@samp{--file=archive.tar} or @samp{--file archive.tar}. +@option{--file=archive.tar} or @option{--file archive.tar}. In contrast, optional arguments must always be introduced using -an equal sign. For example, the @samp{--backup} option takes +an equal sign. For example, the @option{--backup} option takes an optional argument specifying backup type. It must be used -as @samp{--backup=@var{backup-type}}. +as @option{--backup=@var{backup-type}}. @node Short Options @subsection Short Option Style Most options also have a short option name. Short options start with -a single dash, and are followed by a single character, e.g.@: @samp{-t} -(which is equivalent to @samp{--list}). The forms are absolutely +a single dash, and are followed by a single character, e.g.@: @option{-t} +(which is equivalent to @option{--list}). The forms are absolutely identical in function; they are interchangeable. The short option names are faster to type than long option names. @@ -2361,10 +1883,10 @@ The short option names are faster to type than long option names. Short options which require arguments take their arguments immediately following the option, usually separated by white space. It is also possible to stick the argument right after the short option name, using -no intervening space. For example, you might write @w{@samp{-f -archive.tar}} or @samp{-farchive.tar} instead of using -@samp{--file=archive.tar}. Both @samp{--file=@var{archive-name}} and -@w{@samp{-f @var{archive-name}}} denote the option which indicates a +no intervening space. For example, you might write @w{@option{-f +archive.tar}} or @option{-farchive.tar} instead of using +@option{--file=archive.tar}. Both @option{--file=@var{archive-name}} and +@w{@option{-f @var{archive-name}}} denote the option which indicates a specific archive, here named @file{archive.tar}. Short options which take optional arguments take their arguments @@ -2405,9 +1927,9 @@ of letters must be the first to appear on the command line, after the @command{tar} program name and some white space; old options cannot appear anywhere else. The letter of an old option is exactly the same letter as the corresponding short option. For example, the old option @samp{t} is -the same as the short option @samp{-t}, and consequently, the same as the -mnemonic option @samp{--list}. So for example, the command @w{@samp{tar -cv}} specifies the option @samp{-v} in addition to the operation @samp{-c}. +the same as the short option @option{-t}, and consequently, the same as the +mnemonic option @option{--list}. So for example, the command @w{@samp{tar +cv}} specifies the option @option{-v} in addition to the operation @option{-c}. @FIXME{bob suggests having an uglier example. :-) } @@ -2421,14 +1943,14 @@ $ @kbd{tar cvbf 20 /dev/rmt0} @end smallexample @noindent -Here, @samp{20} is the argument of @samp{-b} and @samp{/dev/rmt0} is -the argument of @samp{-f}. +Here, @samp{20} is the argument of @option{-b} and @samp{/dev/rmt0} is +the argument of @option{-f}. On the other hand, this old style syntax makes it difficult to match option letters with their corresponding arguments, and is often confusing. In the command @w{@samp{tar cvbf 20 /dev/rmt0}}, for example, -@samp{20} is the argument for @samp{-b}, @samp{/dev/rmt0} is the -argument for @samp{-f}, and @samp{-v} does not have a corresponding +@samp{20} is the argument for @option{-b}, @samp{/dev/rmt0} is the +argument for @option{-f}, and @option{-v} does not have a corresponding argument. Even using short options like in @w{@samp{tar -c -v -b 20 -f /dev/rmt0}} is clearer, putting all arguments next to the option they pertain to. @@ -2533,7 +2055,7 @@ These last examples mean something completely different from what the user intended (judging based on the example in the previous set which uses long options, whose intent is therefore very clear). The first four specify that the @command{tar} archive would be a file named -@samp{-c}, @samp{c}, @samp{carchive.tar} or @samp{archive.tarc}, +@option{-c}, @samp{c}, @samp{carchive.tar} or @samp{archive.tarc}, respectively. The first two examples also specify a single non-option, @var{name} argument having the value @samp{archive.tar}. The last example contains only old style option letters (repeating option @@ -2570,7 +2092,7 @@ Appends files to the end of the archive. @xref{append}. @item --catenate @itemx -A -Same as @samp{--concatenate}. @xref{concatenate}. +Same as @option{--concatenate}. @xref{concatenate}. @item --compare @itemx -d @@ -2598,7 +2120,7 @@ tape! @xref{delete}. @item --diff @itemx -d -Same @samp{--compare}. @xref{compare}. +Same @option{--compare}. @xref{compare}. @item --extract @itemx -x @@ -2608,7 +2130,7 @@ Extracts members from the archive into the file system. @xref{extract}. @item --get @itemx -x -Same as @samp{--extract}. @xref{extract}. +Same as @option{--extract}. @xref{extract}. @item --list @itemx -t @@ -2618,8 +2140,8 @@ Lists the members in an archive. @xref{list}. @item --update @itemx -u -@FIXME{It was: A combination of the @samp{--compare} and -@samp{--append} operations. This is not true and rather misleading, +@FIXME{It was: A combination of the @option{--compare} and +@option{--append} operations. This is not true and rather misleading, as @value{op-compare} does a lot more than @value{op-update} for ensuring files are identical.} Adds files to the end of the archive, but only if they are newer than their counterparts already in the @@ -2642,7 +2164,7 @@ Normally when creating an archive, @command{tar} strips an initial @item --after-date -(See @samp{--newer}.) @FIXME-pxref{} +(See @option{--newer}.) @FIXME-pxref{} @item --anchored An exclude pattern must match an initial subsequence of the name's components. @@ -2689,7 +2211,7 @@ This option tells @command{tar} to read or write archives through This option directs @command{tar} to print periodic checkpoint messages as it reads through the archive. Its intended for when you want a visual indication that @command{tar} is still running, but don't want to see -@samp{--verbose} output. @FIXME-xref{} +@option{--verbose} output. @FIXME-xref{} @item --check-links @itemx -l @@ -2714,7 +2236,7 @@ while saving space. @FIXME-xref{} @item --confirmation -(See @samp{--interactive}.) @FIXME-pxref{} +(See @option{--interactive}.) @FIXME-pxref{} @item --dereference @itemx -h @@ -2738,9 +2260,14 @@ When performing operations, @command{tar} will skip files that match @item --exclude-from=@var{file} @itemx -X @var{file} -Similar to @samp{--exclude}, except @command{tar} will use the list of +Similar to @option{--exclude}, except @command{tar} will use the list of patterns in the file @var{file}. @FIXME-xref{} +@item --exclude-caches + +Automatically excludes all directories +containing a cache directory tag. @FIXME-xref{} + @item --file=@var{archive} @itemx -f @var{archive} @@ -2757,7 +2284,7 @@ command-line. @FIXME-xref{} @item --force-local -Forces @command{tar} to interpret the filename given to @samp{--file} +Forces @command{tar} to interpret the filename given to @option{--file} as a local file, even if it looks like a remote tape drive name. @FIXME-xref{} @@ -2876,7 +2403,7 @@ the pattern specified in @var{name}. @FIXME-xref{} @item --listed-incremental=@var{snapshot-file} @itemx -g @var{snapshot-file} -During a @samp{--create} operation, specifies that the archive that +During a @option{--create} operation, specifies that the archive that @command{tar} creates is a new @acronym{GNU}-format incremental backup, using @var{snapshot-file} to determine which files to backup. With other operations, informs @command{tar} that the archive is in @@ -2909,6 +2436,14 @@ multi-volume @command{tar} archive. @FIXME-xref{} (see --info-script) +@item -n +@itemx --seek + +Assume that the archive media supports seeks to arbitrary +locations. Usually @command{tar} determines automatically whether +the archive can be seeked or not. This option is intended for use +in cases when such recognition fails. + @item --newer=@var{date} @itemx --after-date=@var{date} @itemx -N @@ -2920,8 +2455,8 @@ the date. @FIXME-xref{} @item --newer-mtime=@var{date} -Like @samp{--newer}, but add only files whose -contents have changed (as opposed to just @samp{--newer}, which will +Like @option{--newer}, but add only files whose +contents have changed (as opposed to just @option{--newer}, which will also back up files for which any status information has changed). @item --no-anchored @@ -2942,13 +2477,13 @@ With this option, @command{tar} will not recurse into directories. When extracting an archive, do not attempt to preserve the owner specified in the @command{tar} archive. This the default behavior -for ordinary users; this option has an effect only for the superuser. +for ordinary users. @item --no-same-permissions When extracting an archive, subtract the user's umask from files from the permissions specified in the archive. This is the default behavior -for ordinary users; this option has an effect only for the superuser. +for ordinary users. @item --no-wildcards Do not use wildcards when excluding files. @@ -2960,7 +2495,7 @@ Wildcards do not match @samp{/} when excluding files. @item --null -When @command{tar} is using the @samp{--files-from} option, this option +When @command{tar} is using the @option{--files-from} option, this option instructs @command{tar} to expect filenames terminated with @kbd{NUL}, so @command{tar} can correctly work with file names that contain newlines. @FIXME-xref{} @@ -3162,12 +2697,12 @@ Same as @option{--format=posix}. @item --preserve -Synonymous with specifying both @samp{--preserve-permissions} and -@samp{--same-order}. @FIXME-xref{} +Synonymous with specifying both @option{--preserve-permissions} and +@option{--same-order}. @FIXME-xref{} @item --preserve-order -(See @samp{--same-order}; @pxref{Reading}.) +(See @option{--same-order}; @pxref{Reading}.) @item --preserve-permissions @itemx --same-permissions @@ -3206,6 +2741,11 @@ from the archive. @xref{Writing}. Directs @command{tar} to remove the source file from the file system after appending it to an archive. @FIXME-xref{} +@item --rmt-command=@var{cmd} + +Notifies @command{tar} that it should use @var{cmd} instead of +the default @file{/usr/libexec/rmt} (@pxref{Remote Tape Server}). + @item --rsh-command=@var{cmd} Notifies @command{tar} that is should use @var{cmd} to communicate with remote @@ -3229,7 +2769,7 @@ effect only for ordinary users. @FIXME-xref{} @item --same-permissions -(See @samp{--preserve-permissions}; @pxref{Writing}.) +(See @option{--preserve-permissions}; @pxref{Writing}.) @item --show-defaults @@ -3260,13 +2800,14 @@ This option affects extraction only; @command{tar} will skip extracting files in the archive until it finds one that matches @var{name}. @xref{Scarce}. -@item --strip-path=@var{number} +@item --strip-components=@var{number} Strip given @var{number} of leading components from file names before -extraction. For example, if archive @file{archive.tar} contained +extraction.@footnote{This option was called @option{--strip-path} in +version 1.14.} For example, if archive @file{archive.tar} contained @file{/some/file/name}, then running @smallexample -tar --extract --file archive.tar --strip-path=2 +tar --extract --file archive.tar --strip-components=2 @end smallexample @noindent @@ -3303,11 +2844,11 @@ rather than the modification time stored in the archive. @item --uncompress -(See @samp{--compress}.) @FIXME-pxref{} +(See @option{--compress}.) @FIXME-pxref{} @item --ungzip -(See @samp{--gzip}.) @FIXME-pxref{} +(See @option{--gzip}.) @FIXME-pxref{} @item --unlink-first @itemx -U @@ -3323,7 +2864,7 @@ presumed to be a compression program of some sort. @FIXME-xref{} @item --utc Display file modification dates in @acronym{UTC}. This option implies -@samp{--verbose}. +@option{--verbose}. @item --verbose @itemx -v @@ -3346,7 +2887,7 @@ it is and a copyright message, some credits, and then exit. @item --volno-file=@var{file} -Used in conjunction with @samp{--multi-volume}. @command{tar} will keep track +Used in conjunction with @option{--multi-volume}. @command{tar} will keep track of which volume of a multi-volume archive its working in @var{file}. @FIXME-xref{} @@ -3369,119 +2910,119 @@ them with the equivalent long option. @item -A -@samp{--concatenate} +@option{--concatenate} @item -B -@samp{--read-full-records} +@option{--read-full-records} @item -C -@samp{--directory} +@option{--directory} @item -F -@samp{--info-script} +@option{--info-script} @item -G -@samp{--incremental} +@option{--incremental} @item -K -@samp{--starting-file} +@option{--starting-file} @item -L -@samp{--tape-length} +@option{--tape-length} @item -M -@samp{--multi-volume} +@option{--multi-volume} @item -N -@samp{--newer} +@option{--newer} @item -O -@samp{--to-stdout} +@option{--to-stdout} @item -P -@samp{--absolute-names} +@option{--absolute-names} @item -R -@samp{--block-number} +@option{--block-number} @item -S -@samp{--sparse} +@option{--sparse} @item -T -@samp{--files-from} +@option{--files-from} @item -U -@samp{--unlink-first} +@option{--unlink-first} @item -V -@samp{--label} +@option{--label} @item -W -@samp{--verify} +@option{--verify} @item -X -@samp{--exclude-from} +@option{--exclude-from} @item -Z -@samp{--compress} +@option{--compress} @item -b -@samp{--blocking-factor} +@option{--blocking-factor} @item -c -@samp{--create} +@option{--create} @item -d -@samp{--compare} +@option{--compare} @item -f -@samp{--file} +@option{--file} @item -g -@samp{--listed-incremental} +@option{--listed-incremental} @item -h -@samp{--dereference} +@option{--dereference} @item -i -@samp{--ignore-zeros} +@option{--ignore-zeros} @item -j -@samp{--bzip2} +@option{--bzip2} @item -k -@samp{--keep-old-files} +@option{--keep-old-files} @item -l -@samp{--one-file-system}. Use of this short option is deprecated. It +@option{--one-file-system}. Use of this short option is deprecated. It is retained for compatibility with the earlier versions of GNU @command{tar}, and will be changed in future releases. @@ -3489,52 +3030,52 @@ is retained for compatibility with the earlier versions of GNU @item -m -@samp{--touch} +@option{--touch} @item -o -When creating --- @samp{--no-same-owner}, when extracting --- -@samp{--portability}. +When creating --- @option{--no-same-owner}, when extracting --- +@option{--portability}. The later usage is deprecated. It is retained for compatibility with the earlier versions of @GNUTAR{}. In the future releases -@option{-o} will be equivalent to @samp{--no-same-owner} only. +@option{-o} will be equivalent to @option{--no-same-owner} only. @item -p -@samp{--preserve-permissions} +@option{--preserve-permissions} @item -r -@samp{--append} +@option{--append} @item -s -@samp{--same-order} +@option{--same-order} @item -t -@samp{--list} +@option{--list} @item -u -@samp{--update} +@option{--update} @item -v -@samp{--verbose} +@option{--verbose} @item -w -@samp{--interactive} +@option{--interactive} @item -x -@samp{--extract} +@option{--extract} @item -z -@samp{--gzip} +@option{--gzip} @end table @@ -3686,8 +3227,8 @@ The @value{op-totals} option---which is only meaningful when used with amount written to the archive, after it has been fully created. The @value{op-checkpoint} option prints an occasional message -as @command{tar} reads or writes the archive. In fact, it print -directory names while reading the archive. It is designed for +as @command{tar} reads or writes the archive. In fact, it prints +a message each 10 records read or written. It is designed for those who don't need the more detailed (and voluminous) output of @value{op-block-number}, but do want visual confirmation that @command{tar} is actually making forward progress. @@ -3732,7 +3273,7 @@ exclude some files and archive members from the operation (for instance if disk or storage space is tight). You can do this by excluding certain files automatically (@pxref{Choosing}), or by performing an operation interactively, using the @value{op-interactive} option. -@command{tar} also accepts @samp{--confirmation} for this option. +@command{tar} also accepts @option{--confirmation} for this option. When the @value{op-interactive} option is specified, before reading, writing, or deleting files, @command{tar} first prints a message @@ -3878,8 +3419,8 @@ it still introduces the info in the chapter correctly : ).} In the last chapter, you learned about the first three operations to @command{tar}. This chapter presents the remaining five operations to -@command{tar}: @samp{--append}, @samp{--update}, @samp{--concatenate}, -@samp{--delete}, and @samp{--compare}. +@command{tar}: @option{--append}, @option{--update}, @option{--concatenate}, +@option{--delete}, and @option{--compare}. You are not likely to use these operations as frequently as those covered in the last chapter; however, since they perform specialized @@ -3924,23 +3465,20 @@ Compare archive members to their counterparts in the file system. @end table @node append -@subsection How to Add Files to Existing Archives: @code{--append} +@subsection How to Add Files to Existing Archives: @option{--append} @UNREVISED If you want to add files to an existing archive, you don't need to create a new archive; you can use @value{op-append}. The archive must -already exist in order to use @samp{--append}. (A related operation -is the @samp{--update} operation; you can use this to add newer +already exist in order to use @option{--append}. (A related operation +is the @option{--update} operation; you can use this to add newer versions of archive members to an existing archive. To learn how to -do this with @samp{--update}, @pxref{update}.) - -@FIXME{Explain in second paragraph whether you can get to the previous -version -- explain whole situation somewhat more clearly.} +do this with @option{--update}, @pxref{update}.) If you use @value{op-append} to add a file that has the same name as an archive member to an archive containing that archive member, then the old member is not deleted. What does happen, however, is somewhat -complex. @command{tar} @emph{allows} you to have infinite numbers of files +complex. @command{tar} @emph{allows} you to have infinite number of files with the same name. Some operations treat these same-named members no differently than any other set of archive members: for example, if you view an archive with @value{op-list}, you will see all of those members @@ -3950,25 +3488,44 @@ Other operations don't deal with these members as perfectly as you might prefer; if you were to use @value{op-extract} to extract the archive, only the most recently added copy of a member with the same name as four other members would end up in the working directory. This is because -@samp{--extract} extracts an archive in the order the members appeared +@option{--extract} extracts an archive in the order the members appeared in the archive; the most recently archived members will be extracted last. Additionally, an extracted member will @emph{replace} a file of the same name which existed in the directory already, and @command{tar} -will not prompt you about this. Thus, only the most recently archived +will not prompt you about this@footnote{Unless you give it +@option{--keep-old-files} option, or the disk copy is newer than the +the one in the archive and you invoke @command{tar} with +@option{--keep-newer-files} option}. Thus, only the most recently archived member will end up being extracted, as it will replace the one extracted before it, and so on. +There exists a special option that allows you to get around this +behavior and extract (or list) only a particular copy of the file. +This is @option{--occurrence} option. If you run @command{tar} with +this option, it will extract only the first copy of the file. You +may also give this option an argument specifying the number of +copy to be extracted. Thus, for example if the archive +@file{archive.tar} contained three copies of file @file{myfile}, then +the command + +@smallexample +tar --extract --file archive.tar --occurrence=2 myfile +@end smallexample + +@noindent +would extract only the second copy. @xref{Option Summary,---occurrence}, for the description of @value{op-occurrence} option. + @FIXME{ hag -- you might want to incorporate some of the above into the -MMwtSN node; not sure. i didn't know how to make it simpler...} +MMwtSN node; not sure. i didn't know how to make it simpler... -There are a few ways to get around this. @FIXME-xref{Multiple Members +There are a few ways to get around this. (maybe xref Multiple Members with the Same Name.} @cindex Members, replacing with other members @cindex Replacing members with other members If you want to replace an archive member, use @value{op-delete} to delete the member you want to remove from the archive, , and then use -@samp{--append} to add the member you want to be in the archive. Note +@option{--append} to add the member you want to be in the archive. Note that you can not change the order of the archive; the most recently added member will still appear last. In this sense, you cannot truly ``replace'' one member with another. (Replacing one member with another @@ -3990,7 +3547,7 @@ and @ref{Media}, for more information.) The simplest way to add a file to an already existing archive is the @value{op-append} operation, which writes specified files into the archive whether or not they are already among the archived files. -When you use @samp{--append}, you @emph{must} specify file name +When you use @option{--append}, you @emph{must} specify file name arguments, as there is no default. If you specify a file that already exists in the archive, another copy of the file will be added to the end of the archive. As with other operations, the member names of the @@ -3998,12 +3555,12 @@ newly added files will be exactly the same as their names given on the command line. The @value{op-verbose} option will print out the names of the files as they are written into the archive. -@samp{--append} cannot be performed on some tape drives, unfortunately, +@option{--append} cannot be performed on some tape drives, unfortunately, due to deficiencies in the formats those tape drives use. The archive must be a valid @command{tar} archive, or else the results of using this operation will be unpredictable. @xref{Media}. -To demonstrate using @samp{--append} to add a file to an archive, +To demonstrate using @option{--append} to add a file to an archive, create a file called @file{rock} in the @file{practice} directory. Make sure you are in the @file{practice} directory. Then, run the following @command{tar} command to add @file{rock} to @@ -4034,8 +3591,8 @@ title claims it will become...} You can use @value{op-append} to add copies of files which have been updated since the archive was created. (However, we do not recommend doing this since there is another @command{tar} option called -@samp{--update}; @pxref{update} for more information. We describe this -use of @samp{--append} here for the sake of completeness.) @FIXME{is +@option{--update}; @pxref{update} for more information. We describe this +use of @option{--append} here for the sake of completeness.) @FIXME{is this really a good idea, to give this whole description for something which i believe is basically a Stupid way of doing something? certain aspects of it show ways in which tar is more broken than i'd personally @@ -4067,7 +3624,7 @@ blues @end smallexample @noindent -Because you specified the @samp{--verbose} option, @command{tar} has +Because you specified the @option{--verbose} option, @command{tar} has printed the name of the file being appended as it was acted on. Now list the contents of the archive: @@ -4085,10 +3642,20 @@ The newest version of @file{blues} is now at the end of the archive (note the different creation dates and file sizes). If you extract the archive, the older version of the file @file{blues} will be replaced by the newer version. You can confirm this by extracting -the archive and running @samp{ls} on the directory. @xref{Writing}, -for more information. (@emph{Please note:} This is the case unless -you employ the @value{op-backup} option. @FIXME-ref{Multiple Members -with the Same Name}.) +the archive and running @samp{ls} on the directory. + +If you wish to extract the first occurrence of the file @file{blues} +from the archive, use @value{op-occurrence} option, as shown in +the following example: + +@smallexample +$ @kbd{tar --extract -vv --occurrence --file=collection.tar blues} +-rw-rw-rw- me user 21 1996-09-23 16:44 blues +@end smallexample + +@xref{Writing}, for more information on @value{op-extract} and +@xref{Option Summary, --occurrence}, for the description of +@value{op-occurrence} option. @node update @subsection Updating an Archive @@ -4097,19 +3664,19 @@ with the Same Name}.) In the previous section, you learned how to use @value{op-append} to add a file to an existing archive. A related operation is -@value{op-update}. The @samp{--update} operation updates a @command{tar} +@value{op-update}. The @option{--update} operation updates a @command{tar} archive by comparing the date of the specified archive members against the date of the file with the same name. If the file has been modified more recently than the archive member, then the newer version of the file is added to the archive (as with @value{op-append}). -Unfortunately, you cannot use @samp{--update} with magnetic tape drives. +Unfortunately, you cannot use @option{--update} with magnetic tape drives. The operation will fail. @FIXME{other examples of media on which --update will fail? need to ask charles and/or mib/thomas/dave shevett..} -Both @samp{--update} and @samp{--append} work by adding to the end +Both @option{--update} and @option{--append} work by adding to the end of the archive. When you extract a file from the archive, only the version stored last will wind up in the file system, unless you use the @value{op-backup} option. @FIXME-ref{Multiple Members with the @@ -4120,7 +3687,7 @@ Same Name} @end menu @node how to update -@subsubsection How to Update an Archive Using @code{--update} +@subsubsection How to Update an Archive Using @option{--update} You must use file name arguments with the @value{op-update} operation. If you don't specify any files, @command{tar} won't act on any files and @@ -4130,7 +3697,7 @@ you). @FIXME{note: the above parenthetical added because in fact, this behavior just confused the author. :-) } -To see the @samp{--update} option at work, create a new file, +To see the @option{--update} option at work, create a new file, @file{classical}, in your practice directory, and some extra text to the file @file{blues}, using any text editor. Then invoke @command{tar} with the @samp{update} operation and the @value{op-verbose} option specified, @@ -4165,7 +3732,7 @@ options intended specifically for backups are more efficient. If you need to run backups, please consult @ref{Backups}. @node concatenate -@subsection Combining Archives with @code{--concatenate} +@subsection Combining Archives with @option{--concatenate} @cindex Adding archives to an archive @cindex Concatenating Archives @@ -4174,7 +3741,7 @@ an archive rather than adding individual files to the archive. To add one or more archives to the end of another archive, you should use the @value{op-concatenate} operation. -To use @samp{--concatenate}, name the archives to be concatenated on the +To use @option{--concatenate}, name the archives to be concatenated on the command line. (Nothing happens if you don't list any.) The members, and their member names, will be copied verbatim from those archives. If this causes multiple members to have the same name, it does not delete @@ -4182,7 +3749,7 @@ any members; all the members with the same name coexist. @FIXME-ref{For information on how this affects reading the archive, Multiple Members with the Same Name.} -To demonstrate how @samp{--concatenate} works, create two small archives +To demonstrate how @option{--concatenate} works, create two small archives called @file{bluesrock.tar} and @file{folkjazz.tar}, using the relevant files from @file{practice}: @@ -4226,7 +3793,7 @@ jazz folk @end smallexample -When you use @samp{--concatenate}, the source and target archives must +When you use @option{--concatenate}, the source and target archives must already exist and must have been created using compatible format parameters. @FIXME-pxref{Matching Format Parameters}The new, concatenated archive will be called by the same name as the first @@ -4239,12 +3806,12 @@ tape drives, due to deficiencies in the formats those tape drives use. @cindex @code{concatenate} vs @command{cat} @cindex @command{cat} vs @code{concatenate} It may seem more intuitive to you to want or try to use @command{cat} to -concatenate two archives instead of using the @samp{--concatenate} +concatenate two archives instead of using the @option{--concatenate} operation; after all, @command{cat} is the utility for combining files. However, @command{tar} archives incorporate an end-of-file marker which must be removed if the concatenated archives are to be read properly as -one archive. @samp{--concatenate} removes the end-of-archive marker +one archive. @option{--concatenate} removes the end-of-archive marker from the target archive before each new archive is appended. If you use @command{cat} to combine the archives, the result will not be a valid @command{tar} format archive. If you need to retrieve files from an @@ -4260,7 +3827,7 @@ environment variable @env{TAPE}, or, if this has not been set, the default archive name. @node delete -@subsection Removing Archive Members Using @samp{--delete} +@subsection Removing Archive Members Using @option{--delete} @UNREVISED @cindex Deleting files from an archive @cindex Removing files from an archive @@ -4271,16 +3838,16 @@ specify the names of the members to be deleted; if you list no member names, nothing will be deleted. The @value{op-verbose} option will cause @command{tar} to print the names of the members as they are deleted. As with @value{op-extract}, you must give the exact member names when -using @samp{tar --delete}. @samp{--delete} will remove all versions of -the named file from the archive. The @samp{--delete} operation can run +using @samp{tar --delete}. @option{--delete} will remove all versions of +the named file from the archive. The @option{--delete} operation can run very slowly. -Unlike other operations, @samp{--delete} has no short form. +Unlike other operations, @option{--delete} has no short form. -@cindex Tapes, using @code{--delete} and +@cindex Tapes, using @option{--delete} and @cindex Deleting from tape archives This operation will rewrite the archive. You can only use -@samp{--delete} on an archive if the archive device allows you to +@option{--delete} on an archive if the archive device allows you to write to any point on the media, such as a disk; because of this, it does not work on magnetic tapes. Do not try to delete an archive member from a magnetic tape; the action will not succeed, and you will be @@ -4323,7 +3890,7 @@ The @value{op-delete} option has been reported to work properly when @cindex Verifying the currency of an archive @UNREVISED -The @samp{--compare} (@samp{-d}), or @samp{--diff} operation compares +The @option{--compare} (@option{-d}), or @option{--diff} operation compares specified archive members against files with the same names, and then reports differences in file size, mode, owner, modification date and contents. You should @emph{only} specify archive member names, not file @@ -4368,12 +3935,12 @@ archive represents the current state of files on disk, more than validating the integrity of the archive media. For this later goal, @xref{verify}. @node create options -@section Options Used by @code{--create} +@section Options Used by @option{--create} The previous chapter described the basics of how to use @value{op-create} to create an archive from a set of files. @xref{create}. This section described advanced options to be used with -@samp{--create}. +@option{--create}. @menu * Ignore Failed Read:: @@ -4388,7 +3955,7 @@ Do not exit with nonzero on unreadable files or directories. @end table @node extract options -@section Options Used by @code{--extract} +@section Options Used by @option{--extract} @UNREVISED @FIXME{i need to get dan to go over these options with me and see if @@ -4398,10 +3965,10 @@ The previous chapter showed how to use @value{op-extract} to extract an archive into the filesystem. Various options cause @command{tar} to extract more information than just file contents, such as the owner, the permissions, the modification date, and so forth. This section -presents options to be used with @samp{--extract} when certain special +presents options to be used with @option{--extract} when certain special considerations arise. You may review the information presented in @ref{extract} for more basic information about the -@samp{--extract} operation. +@option{--extract} operation. @menu * Reading:: Options to Help Read Archives @@ -4547,7 +4114,7 @@ renamed the whole hierarchy from @file{/usr/local2} to not be welcome at all that @GNUTAR{} removes the whole hierarchy just to make room for the link to be reinstated (unless it @emph{also} simultaneously restores the full -@file{/usr/local2}, of course! @GNUTAR{} is indeed +@file{/usr/local2}, of course!) @GNUTAR{} is indeed able to remove a whole hierarchy to reestablish a symbolic link, for example, but @emph{only if} @value{op-recursive-unlink} is specified to allow this behavior. In any case, single files are silently @@ -4661,7 +4228,7 @@ Use in conjunction with @value{op-extract}. @unnumberedsubsubsec Setting Access Permissions To set the modes (access permissions) of extracted files to those -recorded for those files in the archive, use @samp{--same-permissions} +recorded for those files in the archive, use @option{--same-permissions} in conjunction with the @value{op-extract} operation. @FIXME{Should be aliased to ignore-umask.} @@ -4869,7 +4436,7 @@ Always make simple backups. @opindex --suffix @cindex backup suffix @vindex SIMPLE_BACKUP_SUFFIX -Append @var{suffix} to each backup file made with @samp{--backup}. If this +Append @var{suffix} to each backup file made with @option{--backup}. If this option is not specified, the value of the @env{SIMPLE_BACKUP_SUFFIX} environment variable is used. And if @env{SIMPLE_BACKUP_SUFFIX} is not set, the default is @samp{~}, just as in Emacs. @@ -5012,7 +4579,7 @@ distribution. @end ifclear -This chapter documents both the provided FSF scripts and @command{tar} +This chapter documents both the provided shell scripts and @command{tar} options which are more specific to usage as a backup tool. To @dfn{back up} a file system means to create archives that contain @@ -5243,7 +4810,7 @@ actually created. Incremental dumps depend crucially on time stamps, so the results are unreliable if you modify a file's time stamps during dumping (e.g.@: -with the @samp{--atime-preserve} option), or if you set the clock +with the @option{--atime-preserve} option), or if you set the clock backwards. Despite it should be obvious that a device has a non-volatile value, NFS @@ -5255,7 +4822,7 @@ to comparing directories; this is fairly gross, but there does not seem to be a better way to go. @command{tar} doesn't access @var{snapshot-file} when -@value{op-create} or @value{op-list} are specified, but the +@value{op-extract} or @value{op-list} are specified, but the @value{op-listed-incremental} option must still be given. A placeholder @var{snapshot-file} can be specified, e.g., @file{/dev/null}. @@ -5438,7 +5005,7 @@ located on the remote machine and containing the list of files to be excluded from the backup. Exclude file lists are searched in /etc/tar-backup directory. A common use for exclude file lists is to exclude files containing security-sensitive information -(e.g. @file{/etc/shadow} from backups. +(e.g. @file{/etc/shadow} from backups). This variable affects only @code{backup}. @end defvr @@ -5492,7 +5059,7 @@ mt_begin() @{ @end defvr @defvr {Backup variable} MT_REWIND -THe name of @dfn{rewind} function. The default definition is as +The name of @dfn{rewind} function. The default definition is as follows: @smallexample @@ -5535,14 +5102,14 @@ mt_status() @{ @subsection User Hooks @dfn{User hooks} are shell functions executed before and after -each @command{tar} invocations. Thus, there are @dfn{backup +each @command{tar} invocation. Thus, there are @dfn{backup hooks}, which are executed before and after dumping each file system, and @dfn{restore hooks}, executed before and after restoring a file system. Each user hook is a shell function taking four arguments: @deffn {User Hook Function} hook @var{level} @var{host} @var{fs} @var{fsname} -The arguments are: +Its arguments are: @table @var @item level @@ -5581,7 +5148,7 @@ Executed after restoring the filesystem. @node backup-specs example @subsection An Example Text of @file{Backup-specs} -The following is the text of @file{backup-specs} as it appears at FSF: +The following is an example of @file{backup-specs}: @smallexample # site-specific parameters for file system backup. @@ -5683,8 +5250,8 @@ and files dumped, what time the backup was made, and any error messages that were generated, as well as how much space was left in the media volume after the last volume of the archive was written. You should check this log file after every backup. The file name is -@file{log-@var{mmm-ddd-yyyy}-level-@var{n}}, where @var{n} represents -current dump level number. +@file{log-@var{mm-dd-yyyy}-level-@var{n}}, where @var{mm-dd-yyyy} +represents current date, and @var{n} represents current dump level number. The script also prints the name of each system being dumped to the standard output. @@ -5701,7 +5268,7 @@ Do backup level @var{level} (default 0). @itemx --force Force backup even if today's log file already exists. -@item -v@var{level} +@item -v[@var{level}] @itemx --verbose[=@var{level}] Set verbosity level. The higher the level is, the more debugging information will be output during execution. Devault @var{level} @@ -5730,7 +5297,7 @@ Display program version and exit. To restore files that were archived using a scripted backup, use the @code{restore} script. Its usage is quite straightforward. In the -simplest form, invoke @command{restore} without options, it will +simplest form, invoke @code{restore --all}, it will then restore all the filesystems and files specified in @file{backup-specs} (@pxref{General-Purpose Variables,BACKUP_DIRS}). @@ -5768,11 +5335,15 @@ restore --level=1 The full list of options accepted by @code{restore} follows: @table @option +@item -a +@itemx --all +Restore all filesystems and files specified in @file{backup-specs} + @item -l @var{level} @itemx --level=@var{level} Start restoring from the given backup level, instead of the default 0. -@item -v@var{level} +@item -v[@var{level}] @itemx --verbose[=@var{level}] Set verbosity level. The higher the level is, the more debugging information will be output during execution. Devault @var{level} @@ -5866,7 +5437,7 @@ $ @kbd{tar -cvf collection.tar blues folk jazz} @noindent @file{collection.tar} is the name of the archive. It must directly -follow the @samp{-f} option, since whatever directly follows @samp{-f} +follow the @option{-f} option, since whatever directly follows @option{-f} @emph{will} end up naming the archive. If you neglect to specify an archive name, you may end up overwriting a file in the working directory with the archive you create since @command{tar} will use this file's name @@ -5912,7 +5483,7 @@ use the following: @noindent @command{tar} will complete the remote connection, if possible, and prompt you for a username and password. If you use -@samp{--file=@@@var{hostname}:/@var{dev}/@var{file name}}, @command{tar} +@option{--file=@@@var{hostname}:/@var{dev}/@var{file name}}, @command{tar} will complete the remote connection, if possible, using your username as the username on the remote machine. @@ -5924,8 +5495,11 @@ program, with a username of @var{user}. If the username is omitted (along with the @samp{@@} sign), then your user name will be used. (This is the normal @command{rsh} behavior.) It is necessary for the remote machine, in addition to permitting your @command{rsh} access, to -have the @file{/usr/ucb/rmt} program installed. If you need to use a -file whose name includes a colon, then the remote tape drive behavior +have the @file{rmt} program installed (This command is included in +the @GNUTAR{} distribution and by default is installed under +@file{@var{prefix}/libexec/rmt}, were @var{prefix} means your +installation prefix). If you need to use a file whose name includes a +colon, then the remote tape drive behavior can be inhibited by using the @value{op-force-local} option. @FIXME{i know we went over this yesterday, but bob (and now i do again, @@ -5955,6 +5529,10 @@ the command line, as follows: @kbd{tar} @var{operation} [@var{option1} @var{option2} @dots{}] [@var{file name-1} @var{file name-2} @dots{}] @end smallexample +If a file name begins with dash (@samp{-}), preceede it with +@option{--add-file} option to preventit from being treated as an +option. + If you specify a directory name as a file name argument, all the files in that directory are operated on by @command{tar}. @@ -5973,7 +5551,6 @@ specifying the names of files and archive members. @node files @section Reading Names from a File -@UNREVISED @cindex Reading file names from a file @cindex Lists of file names @@ -5982,8 +5559,8 @@ Instead of giving the names of files or archive members on the command line, you can put the names into a file, and then use the @value{op-files-from} option to @command{tar}. Give the name of the file which contains the list of files to include as the argument to -@samp{--files-from}. In the list, the file names should be separated by -newlines. You will frequently use this option when you have generated +@option{--files-from}. In the list, the file names should be separated by +newlines. You will frequently use this option when you have generated the list of files to archive with the @command{find} utility. @table @kbd @@ -5992,21 +5569,23 @@ the list of files to archive with the @command{find} utility. Get names to extract or create from file @var{file name}. @end table -If you give a single dash as a file name for @samp{--files-from}, (i.e., -you specify either @samp{--files-from=-} or @samp{-T -}), then the file +If you give a single dash as a file name for @option{--files-from}, (i.e., +you specify either @code{--files-from=-} or @code{-T -}), then the file names are read from standard input. -Unless you are running @command{tar} with @samp{--create}, you can not use -both @samp{--files-from=-} and @samp{--file=-} (@samp{-f -}) in the same +Unless you are running @command{tar} with @option{--create}, you can not use +both @code{--files-from=-} and @code{--file=-} (@code{-f -}) in the same command. +Any number of @option{-T} options can be given in the command line. + @FIXME{add bob's example, from his message on 2-10-97} The following example shows how to use @command{find} to generate a list of files smaller than 400K in length and put that list into a file -called @file{small-files}. You can then use the @samp{-T} option to +called @file{small-files}. You can then use the @option{-T} option to @command{tar} to specify the files from that file, @file{small-files}, to -create the archive @file{little.tgz}. (The @samp{-z} option to +create the archive @file{little.tgz}. (The @option{-z} option to @command{tar} compresses the archive with @command{gzip}; @pxref{gzip} for more information.) @@ -6016,7 +5595,84 @@ $ @kbd{tar -c -v -z -T small-files -f little.tgz} @end smallexample @noindent -@FIXME{say more here to conclude the example/section?} +In the file list given by @option{-T} option, any file name beginning +with @samp{-} character is considered a @command{tar} option and is +processed accordingly.@footnote{Versions of @GNUTAR{} up to 1.15.1 +recognized only @option{-C} option in file lists, and only if the +option and its argument occupied two consecutive lines.} For example, +the common use of this feature is to change to another directory by +specifying @option{-C} option: + +@smallexample +@group +$ @kbd{cat list} +-C/etc +passwd +hosts +-C/lib +libc.a +$ @kbd{tar -c -f foo.tar --files-from list} +@end group +@end smallexample + +@noindent +In this example, @command{tar} will first switch to @file{/etc} +directory and add files @file{passwd} and @file{hosts} to the +archive. Then it will change to @file{/lib} directory and will archive +the file @file{libc.a}. Thus, the resulting archive @file{foo.tar} will +contain: + +@smallexample +@group +$ @kbd{tar tf foo.tar} +passwd +hosts +libc.a +@end group +@end smallexample + +@noindent +Notice that the option parsing algorithm used with @option{-T} is +stricter than the one used by shell. Namely, when specifying option +arguments, you should observe the following rules: + +@itemize @bullet +@item +When using short (single-letter) option form, its argument must +immediately follow the option letter, without any intervening +whitespace. For example: @code{-Cdir}. + +@item +When using long option form, the option argument must be separated +from the option by a single equal sign. No whitespace is allowed on +any side of the equal sign. For example: @code{--directory=dir}. + +@item +For both short and long option forms, the option argument can be given +on the next line after the option name, e.g.: + +@smallexample +@group +--directory +dir +@end group +@end smallexample + +@noindent +and + +@smallexample +@group +-C +dir +@end group +@end smallexample +@end itemize + +@cindex @option{--add-file} +If you happen to have a file whose name starts with @samp{-}, +precede it with @option{--add-file} option to prevent it from +being recognized as an option. For example: @code{--add-file --my-file}. @menu * nul:: @@ -6029,7 +5685,7 @@ $ @kbd{tar -c -v -z -T small-files -f little.tgz} @cindex @kbd{NUL} terminated file names The @value{op-null} option causes @value{op-files-from} to read file names terminated by a @code{NUL} instead of a newline, so files whose -names contain newlines can be archived using @samp{--files-from}. +names contain newlines can be archived using @option{--files-from}. @table @kbd @item --null @@ -6037,21 +5693,20 @@ Only consider @kbd{NUL} terminated file names, instead of files that terminate in a newline. @end table -The @samp{--null} option is just like the one in @acronym{GNU} +The @value{op-null} option is just like the one in @acronym{GNU} @command{xargs} and @command{cpio}, and is useful with the -@samp{-print0} predicate of @acronym{GNU} @command{find}. In -@command{tar}, @samp{--null} also causes @value{op-directory} options -to be treated as file names to archive, in case there are any files -out there called @file{-C}. +@option{-print0} predicate of @acronym{GNU} @command{find}. In +@command{tar}, @value{op-null} also disables special handling for +file names that begin with dash. This example shows how to use @command{find} to generate a list of files larger than 800K in length and put that list into a file called -@file{long-files}. The @samp{-print0} option to @command{find} just just -like @samp{-print}, except that it separates files with a @kbd{NUL} +@file{long-files}. The @option{-print0} option to @command{find} is just +like @option{-print}, except that it separates files with a @kbd{NUL} rather than with a newline. You can then run @command{tar} with both the -@samp{--null} and @samp{-T} options to specify that @command{tar} get the +@option{--null} and @option{-T} options to specify that @command{tar} get the files from that file, @file{long-files}, to create the archive -@file{big.tgz}. The @samp{--null} option to @command{tar} will cause +@file{big.tgz}. The @option{--null} option to @command{tar} will cause @command{tar} to recognize the @kbd{NUL} separator between files. @smallexample @@ -6083,7 +5738,7 @@ For example, to create an archive with all the contents of the directory @file{src} except for files whose names end in @file{.o}, use the command @samp{tar -cf src.tar --exclude='*.o' src}. -You may give multiple @samp{--exclude} options. +You may give multiple @option{--exclude} options. @table @kbd @item --exclude-from=@var{file} @@ -6093,7 +5748,7 @@ Causes @command{tar} to ignore files that match the patterns listed in @end table @findex exclude-from -Use the @samp{--exclude-from=@var{file-of-patterns}} option to read a +Use the @option{--exclude-from=@var{file-of-patterns}} option to read a list of patterns, one per line, from @var{file}; @command{tar} will ignore files matching those patterns. Thus if @command{tar} is called as @w{@samp{tar -c -X foo .}} and the file @file{foo} contains a @@ -6103,6 +5758,24 @@ added to the archive. @FIXME{do the exclude options files need to have stuff separated by newlines the same as the files-from option does?} +@table @kbd +@item --exclude-caches +Causes @command{tar} to ignore directories containing a cache directory tag. +@end table + +@findex exclude-caches +When creating an archive, +the @option{--exclude-caches} option +causes @command{tar} to exclude all directories +that contain a @dfn{cache directory tag}. +A cache directory tag is a short file +with the well-known name @file{CACHEDIR.TAG} +and having a standard header +specified in @url{http://www.brynosaurus.com/cachedir/spec.html}. +Various applications write cache directory tags +into directories they use to hold regenerable, non-precious data, +so that such data can be more easily excluded from backups. + @menu * controlling pattern-patching with exclude:: * problems with exclude:: @@ -6134,8 +5807,9 @@ ignores case when excluding @samp{makefile}, but not when excluding @table @option @item --anchored @itemx --no-anchored -If anchored (the default), a pattern must match an initial subsequence -of the name's components. Otherwise, the pattern can match any subsequence. +If anchored, a pattern must match an initial subsequence +of the name's components. Otherwise, the pattern can match any +subsequence. Default is @option{--no-anchored}. @item --ignore-case @itemx --no-ignore-case @@ -6181,7 +5855,7 @@ listed, @samp{dir.o/foo} will be excluded from the archive. You can sometimes confuse the meanings of @value{op-exclude} and @value{op-exclude-from}. Be careful: use @value{op-exclude} when files to be excluded are given as a pattern on the command line. Use -@samp{--exclude-from=@var{file-of-patterns}} to introduce the name of a +@option{--exclude-from=@var{file-of-patterns}} to introduce the name of a file which contains a list of patterns, one per line; each of these patterns can exclude zero, one, or many files. @@ -6214,10 +5888,10 @@ might fail. @item In earlier versions of @command{tar}, what is now the -@samp{--exclude-from=@var{file-of-patterns}} option was called -@samp{--exclude=@var{pattern}} instead. Now, -@samp{--exclude=@var{pattern}} applies to patterns listed on the command -line and @samp{--exclude-from=@var{file-of-patterns}} applies to +@option{--exclude-from=@var{file-of-patterns}} option was called +@option{--exclude=@var{pattern}} instead. Now, +@option{--exclude=@var{pattern}} applies to patterns listed on the command +line and @option{--exclude-from=@var{file-of-patterns}} applies to patterns listed in a file. @end itemize @@ -6288,7 +5962,7 @@ whose modification or inode-changed times are newer than the @var{date} given. If @var{date} starts with @samp{/} or @samp{.}, it is taken to be a file name; the last-modified time of that file is used as the date. If you use this option when creating or appending to an archive, -the archive will only include new files. If you use @samp{--after-date} +the archive will only include new files. If you use @option{--after-date} when extracting an archive, @command{tar} will only extract files newer than the @var{date} you specify. @@ -6369,7 +6043,7 @@ option) for the various files they contain. However, you may not always want @command{tar} to act this way. The @value{op-no-recursion} option inhibits @command{tar}'s recursive descent -into specified directories. If you specify @samp{--no-recursion}, you can +into specified directories. If you specify @option{--no-recursion}, you can use the @command{find} utility for hunting through levels of directories to construct a list of file names which you could then pass to @command{tar}. @command{find} allows you to be more selective when choosing which files to @@ -6385,7 +6059,7 @@ Requires @command{tar} to recursively descend directories. This is the default. @end table -When you use @samp{--no-recursion}, @GNUTAR{} grabs +When you use @option{--no-recursion}, @GNUTAR{} grabs directory entries themselves, but does not descend on them recursively. Many people use @command{find} for locating files they want to back up, and since @command{tar} @emph{usually} recursively @@ -6442,7 +6116,7 @@ Prevents @command{tar} from crossing file system boundaries when archiving. Use in conjunction with any write operation. @end table -The @samp{--one-file-system} option causes @command{tar} to modify its +The @option{--one-file-system} option causes @command{tar} to modify its normal behavior in archiving the contents of directories. If a file in a directory is not on the same filesystem as the directory itself, then @command{tar} will not archive that file. If the file is a directory @@ -6516,7 +6190,7 @@ which records the third file in the archive under the name @samp{tar --extract}, the third file will be written in a subdirectory named @file{orange-colored}. -You can use the @samp{--directory} option to make the archive +You can use the @option{--directory} option to make the archive independent of the original name of the directory holding the files. The following command places the files @file{/etc/passwd}, @file{/etc/hosts}, and @file{/lib/libc.a} into the archive @@ -6532,20 +6206,46 @@ on the command line: @file{passwd}, @file{hosts}, and @file{libc.a}. They will not appear to be related by file name to the original directories where those files were located. -Note that @samp{--directory} options are interpreted consecutively. If -@samp{--directory} specifies a relative file name, it is interpreted +Note that @option{--directory} options are interpreted consecutively. If +@option{--directory} specifies a relative file name, it is interpreted relative to the then current directory, which might not be the same as the original current working directory of @command{tar}, due to a previous -@samp{--directory} option. +@option{--directory} option. + +When using @option{--files-from} (@pxref{files}), you can put various +@command{tar} options (including @option{-C}) in the file list. Notice, +however, that in this case the option and its argument may not be +separated by whitespace. If you use short option, its argument must +either follow the option letter immediately, without any intervening +whitespace, or occupy the next line. Otherwise, if you use long +option, separate its argument by an equal sign. -@FIXME{dan: does this mean that you *can* use the short option form, but -you can *not* use the long option form with --files-from? or is this -totally screwed?} +For instance, the file list for the above example will be: -When using @samp{--files-from} (@pxref{files}), you can put @samp{-C} -options in the file list. Unfortunately, you cannot put -@samp{--directory} options in the file list. (This interpretation can -be disabled by using the @value{op-null} option.) +@smallexample +@group +-C +/etc +passwd +hosts +-C +/lib +libc.a +@end group +@end smallexample + +@noindent +To use it, you would invoke @command{tar} as follows: + +@smallexample +$ @kbd{tar -c -f foo.tar --files-from list} +@end smallexample + +Notice also that you can only use the short option variant in the file +list, i.e. always use @option{-C}, not @option{--directory}. + +The interpretation of @value{op-directory} is disabled by +@value{op-null} option. @node absolute @subsection Absolute File Names @@ -6836,7 +6536,7 @@ information recorded by newer @command{tar} programs. To create an archive in V7 format (not ANSI), which can be read by these old versions, specify the @value{op-format-v7} option in conjunction with the @value{op-create} (@command{tar} also -accepts @samp{--portability} or @samp{op-old-archive} for this +accepts @option{--portability} or @samp{op-old-archive} for this option). When you specify it, @command{tar} leaves out information about directories, pipes, fifos, contiguous files, and device files, and specifies file ownership by @@ -7005,61 +6705,90 @@ it issues a warning, as these time stamps are nonstandard and unportable. @subsection Creating and Reading Compressed Archives @cindex Compressed archives @cindex Storing archives in compressed format -@UNREVISED + +@GNUTAR{} is able to create and read compressed archives. It supports +@command{gzip} and @command{bzip2} compression programms. For backward +compatibilty, it also supports @command{compress} command, although +we strongly recommend against using it, since there is a patent +covering the algorithm it uses and you could be sued for patent +infringement merely by running @command{compress}! Besides, it is less +effective than @command{gzip} and @command{bzip2}. + +Creating a compressed archive is simple: you just specify a +@dfn{compression option} along with the usual archive creation +commands. The compression option is @option{-z} (@option{--gzip}) to +create a @command{gzip} compressed archive, @option{-j} +(@option{--bzip2}) to create a @command{bzip2} compressed archive, and +@option{-Z} (@option{--compress}) to use @command{compress} program. +For example: + +@smallexample +$ @kbd{tar cfz archive.tar.gz .} +@end smallexample + +Reading compressed archive is even simpler: you don't need to specify +any additional options as @GNUTAR{} recognizes its format +automatically. Thus, the following commands will list and extract the +archive created in previous example: + +@smallexample +# List the compressed archive +$ @kbd{tar tf archive.tar.gz} +# Extract the compressed archive +$ @kbd{tar xf archive.tar.gz} +@end smallexample + +The only case when you have to specify a decompression option while +reading the archive is when reading from a pipe or from a tape drive +that does not support random access. However, in this case @GNUTAR{} +will indicate which option you should use. For example: + +@smallexample +$ @kbd{cat archive.tar.gz | tar tf -} +tar: Archive is compressed. Use -z option +tar: Error is not recoverable: exiting now +@end smallexample + +If you see such diagnostics, just add the suggested option to the +invocation of @GNUTAR{}: + +@smallexample +$ @kbd{cat archive.tar.gz | tar tfz -} +@end smallexample + +Notice also, that there are several restrictions on operations on +compressed archives. First of all, compressed archives cannot be +modified, i.e. you cannot update (@value{op-update}) them or delete +(@value{op-delete}) members from them. Likewise, you cannot append +another @command{tar} archive to a compressed archive using +@value{op-append}). Secondly, multi-volume archives cannot be +compressed. + +The following table summarizes compression options used by @GNUTAR{}. @table @kbd @item -z @itemx --gzip @itemx --ungzip Filter the archive through @command{gzip}. -@end table -@FIXME{ach; these two bits orig from "compare" (?). where to put?} Some -format parameters must be taken into consideration when modifying an -archive.@FIXME{???} Compressed archives cannot be modified. - -You can use @samp{--gzip} and @samp{--gunzip} on physical devices +You can use @option{--gzip} and @option{--gunzip} on physical devices (tape drives, etc.) and remote files as well as on normal files; data to or from such devices or remote files is reblocked by another copy of the @command{tar} program to enforce the specified (or default) record size. The default compression parameters are used; if you need to -override them, avoid the @value{op-gzip} option and run @command{gzip} -explicitly. (Or set the @env{GZIP} environment variable.) - -The @value{op-gzip} option does not work with the @value{op-multi-volume} -option, or with the @value{op-update}, @value{op-append}, -@value{op-concatenate}, or @value{op-delete} operations. - -It is not exact to say that @GNUTAR{} is to work in concert -with @command{gzip} in a way similar to @command{zip}, say. Surely, it is -possible that @command{tar} and @command{gzip} be done with a single call, -like in: - -@smallexample -$ @kbd{tar cfz archive.tar.gz subdir} -@end smallexample - -@noindent -to save all of @samp{subdir} into a @code{gzip}'ed archive. Later you -can do: +override them, set @env{GZIP} environment variable, e.g.: @smallexample -$ @kbd{tar xfz archive.tar.gz} +$ @kbd{GZIP=--best tar cfz archive.tar.gz subdir} @end smallexample @noindent -to explode and unpack. - -The difference is that the whole archive is compressed. With -@command{zip}, archive members are archived individually. @command{tar}'s -method yields better compression. On the other hand, one can view the -contents of a @command{zip} archive without having to decompress it. As -for the @command{tar} and @command{gzip} tandem, you need to decompress the -archive to see its contents. However, this may be done without needing -disk space, by using pipes internally: +Another way would be to avoid the @value{op-gzip} option and run +@command{gzip} explicitly: @smallexample -$ @kbd{tar tfz archive.tar.gz} +$ @kbd{tar cf - subdir | gzip --best -c - > archive.tar.gz} @end smallexample @cindex corrupted archives @@ -7077,7 +6806,6 @@ every volume or file, in case of corrupted archives. Doing so, we might lose some compressibility. But this would have make recovering easier. So, there are pros and cons. We'll see! -@table @kbd @item -j @itemx --bzip2 Filter the archive through @code{bzip2}. Otherwise like @value{op-gzip}. @@ -7088,58 +6816,25 @@ Filter the archive through @code{bzip2}. Otherwise like @value{op-gzip}. Filter the archive through @command{compress}. Otherwise like @value{op-gzip}. -@item --use-compress-program=@var{prog} -Filter through @var{prog} (must accept @samp{-d}). -@end table - -@value{op-compress} stores an archive in compressed format. This -option is useful in saving time over networks and space in pipes, and -when storage space is at a premium. @value{op-compress} causes -@command{tar} to compress when writing the archive, or to uncompress when -reading the archive. - -To perform compression and uncompression on the archive, @command{tar} -runs the @command{compress} utility. @command{tar} uses the default -compression parameters; if you need to override them, avoid the -@value{op-compress} option and run the @command{compress} utility -explicitly. It is useful to be able to call the @command{compress} -utility from within @command{tar} because the @command{compress} utility by -itself cannot access remote tape drives. - -The @value{op-compress} option will not work in conjunction with the -@value{op-multi-volume} option or the @value{op-append}, @value{op-update} -and @value{op-delete} operations. @xref{Operations}, for -more information on these operations. +The @acronym{GNU} Project recommends you not use +@command{compress}, because there is a patent covering the algorithm it +uses. You could be sued for patent infringement merely by running +@command{compress}. -If there is no compress utility available, @command{tar} will report an error. -@strong{Please note} that the @command{compress} program may be covered by -a patent, and therefore we recommend you stop using it. +@item --use-compress-program=@var{prog} +Use external compression program @var{prog}. Use this option if you +have a compression program that @GNUTAR{} does not support. There +are two requirements to which @var{prog} should comply: -@value{op-bzip2} acts like @value{op-compress}, except that it uses -the @code{bzip2} utility. +First, when called without options, it should read data from standard +input, compress it and output it on standard output. -@table @kbd -@item --compress -@itemx --uncompress -@itemx -z -@itemx -Z -When this option is specified, @command{tar} will compress (when -writing an archive), or uncompress (when reading an archive). Used in -conjunction with the @value{op-create}, @value{op-extract}, -@value{op-list} and @value{op-compare} operations. +Secondly, if called with @option{-d} argument, it should do exactly +the opposite, i.e. read the compressed data from the standard input +and produce uncompressed data on the standard output. @end table -You can have archives be compressed by using the @value{op-gzip} option. -This will arrange for @command{tar} to use the @command{gzip} program to be -used to compress or uncompress the archive wren writing or reading it. - -To use the older, obsolete, @command{compress} program, use the -@value{op-compress} option. The @acronym{GNU} Project recommends you not use -@command{compress}, because there is a patent covering the algorithm it -uses. You could be sued for patent infringement merely by running -@command{compress}. - -I have one question, or maybe it's a suggestion if there isn't a way +@FIXME{I have one question, or maybe it's a suggestion if there isn't a way to do it now. I would like to use @value{op-gzip}, but I'd also like the output to be fed through a program like @acronym{GNU} @command{ecc} (actually, right now that's @samp{exactly} what I'd like @@ -7165,13 +6860,13 @@ utilities like that? (Leigh Clayton @file{loc@@soliton.com}, May 1995). Isn't that exactly the role of the @value{op-use-compress-prog} option? I never tried it myself, but I suspect you may want to write a @var{prog} script or program able to filter stdin to stdout to -way you want. It should recognize the @samp{-d} option, for when +way you want. It should recognize the @option{-d} option, for when extraction is needed rather than creation. It has been reported that if one writes compressed data (through the @value{op-gzip} or @value{op-compress} options) to a DLT and tries to use the DLT compression mode, the data will actually get bigger and one will -end up with less space on the tape. +end up with less space on the tape.} @node sparse @subsection Archiving Sparse Files @@ -7388,9 +7083,11 @@ gives you a great deal of control already. Extract all protection information. This option causes @command{tar} to set the modes (access permissions) of -extracted files exactly as recorded in the archive. If this option +extracted files exactly as recorded in the archive. If this option is not used, the current @code{umask} setting limits the permissions -on extracted files. +on extracted files. This option is by default enabled when +@command{tar} is executed by a superuser. + This option is meaningless with @value{op-list}. @@ -7892,12 +7589,19 @@ If the file name contains a @samp{:}, it is interpreted as @samp{hostname:file name}. If the @var{hostname} contains an @dfn{at} sign (@kbd{@@}), it is treated as @samp{user@@hostname:file name}. In either case, @command{tar} will invoke the command @command{rsh} (or -@command{remsh}) to start up an @file{/etc/rmt} on the remote machine. If -you give an alternate login name, it will be given to the @command{rsh}. -Naturally, the remote machine must have an executable @file{/etc/rmt}. -This program is free software from the University of California, and a -copy of the source code can be found with the sources for @command{tar}; -it's compiled and installed by default. +@command{remsh}) to start up an @command{/usr/libexec/rmt} on the remote +machine. If you give an alternate login name, it will be given to the +@command{rsh}. +Naturally, the remote machine must have an executable +@command{/usr/libexec/rmt}. This program is free software from the +University of California, and a copy of the source code can be found +with the sources for @command{tar}; it's compiled and installed by default. +The exact path to this utility is determined when configuring the package. +It is @file{@var{prefix}/libexec/rmt}, where @var{prefix} stands for +your installation prefix. This location may also be overridden at +runtime by using @value{op-rmt-command} option (@xref{Option Summary, +---rmt-command}, for detailed description of this option. @xref{Remote +Tape Server}, for the description of @command{rmt} command). If this option is not given, but the environment variable @env{TAPE} is set, its value is used; otherwise, old versions of @command{tar} @@ -7983,15 +7687,16 @@ nonzero status, exit. This implies @value{op-multi-volume}. @pindex rmt In order to access the tape drive on a remote machine, @command{tar} uses the remote tape server written at the University of California at -Berkeley. The remote tape server must be installed as @file{/etc/rmt} -on any machine whose tape drive you want to use. @command{tar} calls -@file{/etc/rmt} by running an @command{rsh} or @command{remsh} to the remote -machine, optionally using a different login name if one is supplied. +Berkeley. The remote tape server must be installed as +@file{@var{prefix}/libexec/rmt} on any machine whose tape drive you +want to use. @command{tar} calls @command{rmt} by running an +@command{rsh} or @command{remsh} to the remote machine, optionally +using a different login name if one is supplied. A copy of the source for the remote tape server is provided. It is Copyright @copyright{} 1983 by the Regents of the University of -California, but can be freely distributed. Instructions for compiling -and installing it are included in the @file{Makefile}. +California, but can be freely distributed. It is compiled and +installed by default. @cindex absolute file names Unless you use the @value{op-absolute-names} option, @GNUTAR{} @@ -8473,9 +8178,9 @@ I was also told that, for recycled tapes, prior erasure (by the same drive unit that will be used to create the archives) sometimes lowers the error rates observed at rewriting time. -I might also use @samp{--number-blocks} instead of -@samp{--block-number}, so @samp{--block} will then expand to -@samp{--blocking-factor} unambiguously. +I might also use @option{--number-blocks} instead of +@option{--block-number}, so @option{--block} will then expand to +@option{--blocking-factor} unambiguously. @node Many @section Many Archives on One Tape @@ -8601,8 +8306,7 @@ head is on. Before writing an archive, you should make sure that no data on the tape will be overwritten (unless it is no longer needed). Before reading an archive, you should make sure the tape head is at the beginning of the archive you want to read. (The @code{restore} -script will find the archive automatically. @FIXME{There is no such -restore script!}@FIXME-xref{Scripted Restoration}@xref{mt}, for +script will find the archive automatically. @FIXME-xref{Scripted Restoration}@xref{mt}, for an explanation of the tape moving utility. If you want to add new archive file entries to a tape, you should @@ -8779,8 +8483,8 @@ Each volume of a multi-volume archive is an independent @command{tar} archive, complete in itself. For example, you can list or extract any volume alone; just don't specify @value{op-multi-volume}. However, if one file in the archive is split across volumes, the only way to extract -it successfully is with a multi-volume extract command @samp{--extract ---multi-volume} (@samp{-xM}) starting on or before the volume where +it successfully is with a multi-volume extract command @option{--extract +--multi-volume} (@option{-xM}) starting on or before the volume where the file begins. For example, let's presume someone has two tape drives on a system @@ -8964,7 +8668,7 @@ if the initial match fails, before giving up. Since the volume numbering is automatically added in labels at creation time, it sounded logical to equally help the user taking care of it when the archive is being read. -The @value{op-label} was once called @samp{--volume}, but is not available +The @value{op-label} was once called @option{--volume}, but is not available under that name anymore. To find out an archive's label entry (or to find out if an archive has