📄 tar.texinfo
字号:
\input texinfo @c -*-texinfo-*-@setfilename tar-info@settitle The @code{tar} Manual: DRAFT@ifinfoThis file documents the tape archive of the GNU system.Copyright (C) 1988 Free Software Foundation, Inc.Permission is granted to make and distribute verbatim copies of thismanual provided the copyright notice and this permission notice arepreserved on all copies.@ignorePermission is granted to process this file through TeX and print theresults, provided the printed document carries copying permissionnotice identical to this one except for the removal of this paragraph(this paragraph not being relevant to the printed manual).@end ignorePermission is granted to copy and distribute modified versions ofthis manual under the conditions for verbatim copying, provided thatthe entire resulting derived work is distributed under the terms ofa permission notice identical to this one.Permission is granted to copy and distribute translations of thismanual into another language, under the above conditions formodified versions.@end ifinfo@iftex@finalout@end iftex@titlepage@sp 11@center @titlefont{tar}@sp 1@center The GNU tape archive@sp 2@center by Jay Fenlason@sp 2@center DRAFT!@sp 1@center @today@page@vskip 0pt plus 1filllCopyright @copyright{} 1988 Free Software Foundation, Inc.Permission is granted to make and distribute verbatim copies ofthis manual provided the copyright notice and this permission noticeare preserved on all copies.@ignorePermission is granted to process this file through Tex and print theresults, provided the printed document carries copying permissionnotice identical to this one except for the removal of this paragraph(this paragraph not being relevant to the printed manual).@end ignorePermission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided that the entireresulting derived work is distributed under the terms of a permissionnotice identical to this one.Permission is granted to copy and distribute translations of this manualinto another language, under the same conditions as for modified versions.@end titlepage@node Top, Preface, (dir), (dir)@node Preface, Why, Top, Top@unnumbered PrefaceThis manual describes the GNU tape archiver, @code{tar}, and how youcan use it to store copies of a file or a group of files in an@dfn{archive}. This archive may be written directly to a magnetictape or other storage medium, stored as a file, or sent through apipe to another program. @code{tar} can also be used to add filesto an already existing archive, list the files in an archive, orextract the files in the archive.@sp 2GNU @code{tar} was written by John Gilmore, and modified by manypeople. The GNU enhancements were written by Jay Fenlason.@ifinfo@ichapter Using the Tape ArchiverYou can use the GNU tape archiver, @code{tar}, to store copies of a fileor a group of files in an @dfn{archive}. This archive may be writtendirectly to a magnetic tape or other storage medium, stored as a file,or sent through a pipe to another program. @code{tar} can also be usedto add files to an already existing archive, list the files in anarchive, or extract the files in the archive.@menu* Why:: What @code{tar} archives are good for.* Commands:: How to tell @code{tar} what to do.* Options:: Options that change the way @code{tar} behaves.* FullDumps:: Using @code{tar} to perform full dumps.* IncDumps:: Using @code{tar} to perform incremental dumps.* Problems:: Common problems using @code{tar}.* Rem Tape:: The remote tape server.* Format:: The format of a @code{tar} archive.@end menu@end ifinfo@node Why, Commands, Preface, Top@chapter The Uses of Tape ArchivesThe tape archiver @code{tar} allows you to store many files in an@dfn{archive file} or @dfn{tar file} which describes the names and contentsof the constituent files. Later you can extract some or all of these filesfrom the archive.Tar files are not restricted to magnetic tapes. The @code{tar} programcan equally well use an ordinary file, or a pipe, or any device, as thearchive. But they were originally designed for use with magnetic tapes,and that is how the name ``tar'' came about.Archive files can be used for transporting a group of files from one systemto another: put all relevant files into an archive on one computer system,transfer the archive to another, and extract the contents there. The basictransfer medium might be magnetic tape, Internet FTP, or even electronicmail (though you must encode the archive with @code{uuencode} in order totransport it properly by mail). Both machines do not have to use the sameoperating system, as long as they both support the @code{tar} program.A magnetic tape can store several files in sequence, but has no names forthem, just relative position on the tape. A tar file or something like itis the only way to store several files on one tape and retain their names.Even when the basic transfer mechanism can keep track of names, as FTP can,the nuisance of handling multiple files, directories, and multiple links,may make a tar file a much easier method.Archive files are also used for long-term storage, which you can thinkof as transportation from one time to another.Piping one @code{tar} to another is an easy way to copy a directory'scontents from one disk to another, while preserving the dates, modes, ownersand link-structure of all the files therein.The GNU version of @code{tar} has special features that allow it to beused to make incremental and full dumps of all the files in afilesystem.@node Commands, Options, Why, Top@chapter The Different Operations @code{tar} Can PerformOne program, @code{tar}, is used to create an archive, to extract filesfrom an archive, to modify an archive, or to list the contents. Eachtime you run @code{tar}, you must give a @dfn{command} to specify whichone of these things you want to do.The command must always be in the first argument to @code{tar}. Thisargument can also contain options (@pxref{Options}). For compatibilitywith Unix @code{tar}, the first argument is always treated as containingcommand and option letters even if it doesn't start with @samp{-}. Thus,@samp{tar c} is equivalent to @samp{tar -c}: both of them specify the@samp{-c} command to create an archive.In addition, a set of long-named options are provided which can be usedinstead of or inter-mixed with the single-letter flags. The long-namedoptions are meant to be easy to remember and logical, while the singleletter flags may not always be. Long-named options are preceded by a@samp{+}. In the list of single-letter commands below, eachcorresponding long-named option is listed next to it, in parentheses.The remaining arguments to @code{tar} are either options, if they startwith @samp{-} or @samp{+}, or files to operate on.The file names that you give as arguments are the files that @code{tar} willact on -- for example, they are the files to put in the archive, or the filesto extract from it. If you don't give any file name arguments, the defaultdepends on which command you used. Some commands use all relevant files;some commands have no default and will report an error if you don't specifyfiles.If a file name argument actually names a directory, then that directoryand all files and subdirectories in it are used.Here is a list of all the @code{tar} commands:@table @samp@item -c@itemx +createThis command tells @code{tar} to create a new archive that contains thefile(s) specified on the command line. If you don't specify files, allthe files in the current directory are used.If the archive file already exists, it is overwritten; the old contentsare lost.@item -d@itemx +compare@itemx +diffThis command causes @code{tar} to compare the archive with the files inthe file system. It will report differences in file size, mode, owner,and contents. If a file exists in the archive, but not in the filesystem, @code{tar} will report this.If you specify file names, those files are compared with the tape andthey must all exist in the archive. If you don't specify files, allthe files in the archive are compared.@item -r@itemx +appendThis command causes @code{tar} to add the specified file(s) to the end ofthe archive. This assumes that the archive file already exists and isin the proper format (which probably means it was created previouslywith the @code{tar} program). If the archive is not in a format that@code{tar} understands, the results will be unpredictable.You must specify the files to be used; there is no default.@item -t@itemx +listThis command causes @code{tar} to display a list of the files in thearchive. If you specify file names, only the files hat you specify willbe mentioned (but each of them is mentioned only if it appears in thearchive).@item -u@itemx +updateThis command causes @code{tar} to add the specified files to the end ofthe archive, like @w{@samp{-r}}, but only when a file doesn't alreadyexist in the archive or is newer than the version in the archive(the last-modification time is compared). Adding files to the end of anarchive can be very slow.You must specify the files to be used; there is no default.@item -x@itemx +extract@itemx +getThis command causes @code{tar} to extract the specified files from thearchive. If no file names are given, all the files in the archive willbe extracted.@item -A@itemx +catenate@itemx +concatenateThis command is used for concatenating several archive files into one bigarchive file. The files to operate on should all be archive files.They are all appended to the end of @emph{the} archive file which@code{tar} works on. (The other files are not changed).You might be tempted to use @code{cat} for this, but it won't ordinarilywork. A @code{tar} archive contains data which indicates the end of thearchive, so more material added to the end with @code{cat} would beignored. This command works because it removes the end-of-archivemarkers from the middle of the result.@item -D@itemx +deleteThis command causes @code{tar} to delete the specified files from thearchive. This command is extremely slow. Warning: Use of this commandon archives stored on magnetic tape may result in a scrambled archive.There is no safe way (except for completely re-writing the archive) todelete files from a magnetic tape.@end table@node Options, FullDumps, Commands, Top@chapter Options That Change How @code{tar} WorksOptions may be specified as individual arguments starting with @samp{-}.In this case, if the option wants an argument (as does, for example,@samp{-f}) then the argument should come after the option, separatedfrom it by a space.All options are optional. Some options make sense with any command, whileothers are meaningful only with particular commands.@refill@menu* General Options:: Options that are always meaningful.* Creation Options:: Options for creating or updating an archive.* Extraction Options:: Options for listing or extracting files.* Option Syntax:: Old syntax for options@end menu@node General Options, Creation Options, , Options@section Options That Are Always Meaningful@table @samp@item -b @var{number}@itemx +block-size @var{number}This option is used to specify a @dfn{blocking factor} for thearchive. When reading or writing the archive, @code{tar}, will doreads and writes of the archive in blocks of @var{number}*512 bytes.The default blocking factor is set when @code{tar} is compiled, and istypically 20.Blocking factors larger than 20 cannot be read by very old versions of@code{tar}, or by some newer versions of @code{tar} running on old machineswith small address spaces.With a magnetic tape, larger blocks give faster throughput and fitmore data on a tape (because there are fewer inter-record gaps). Ifthe archive is in a disk file or a pipe, you may want to specify asmaller blocking factor, since a large one will result in a largenumber of null bytes at the end of the archive.When writing cartridge or other streaming tapes, a much largerblocking factor (say 126 or more) will greatly increase performance.However, you must specify the same blocking factor when reading orupdating the archive.With GNU @code{tar} the blocking factor is limited only by the maximumblock size of the device containing the archive, or by the amount ofavailable virtual memory.@item -f @var{filename}@itemx +file @var{filename}This option is used to specify the file name of the archive @code{tar}works on.If this option is not given, but the environment variable @code{TAPE}is set, its value is used; otherwise, a default archive name (which waspicked when @code{tar} was compiled) is used. The default is normally
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -