plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

tar.1 (3357B)


      1 .TH TAR 1
      2 .SH NAME
      3 tar \- archiver
      4 .SH SYNOPSIS
      5 .B tar
      6 .I key
      7 [
      8 .I file ...
      9 ]
     10 .SH DESCRIPTION
     11 .PP
     12 .I Tar
     13 saves and restores file trees.
     14 It is most often used to transport a tree of files from one
     15 system to another.
     16 The
     17 .I key
     18 is a string that contains
     19 at most one function letter plus optional modifiers.
     20 Other arguments to the command are names of
     21 files or directories to be dumped or restored.
     22 A directory name implies all the contained
     23 files and subdirectories (recursively).
     24 .PP
     25 The function is one of the following letters:
     26 .TP
     27 .B  c
     28 Create a new archive with the given files as contents.
     29 .TP
     30 .B  r
     31 The named files
     32 are appended to the archive.
     33 .TP
     34 .B  t
     35 List all occurrences of each 
     36 .I file
     37 in the archive, or of all files if there are no
     38 .I file
     39 arguments.
     40 .TP
     41 .B  x
     42 Extract the named files from the archive.
     43 If a file is a directory, the directory is extracted recursively.
     44 Modes are restored if possible.
     45 If no file argument is given, extract the entire archive.
     46 If the archive contains multiple entries for a file,
     47 the latest one wins.
     48 .PP
     49 The modifiers are:
     50 .TP
     51 .B f
     52 Use the next argument as the name of the archive instead of
     53 the default standard input (for keys
     54 .B x
     55 and
     56 .BR t )
     57 or standard output (for keys
     58 .B c
     59 and
     60 .BR r ).
     61 .TP
     62 .B g
     63 Use the next (numeric) argument as the group id for files in
     64 the output archive.
     65 .TP
     66 .B k
     67 (keep)
     68 Modifies the behavior of
     69 .B x
     70 not to extract files which already exist.
     71 .TP
     72 .B m
     73 Do not set the modification time on extracted files.
     74 This is the default behavior; the flag exists only for compatibility with other tars.
     75 .TP
     76 .B p
     77 Create archive in POSIX ustar format,
     78 which raises the maximum pathname length from 100 to 256 bytes.
     79 Ustar archives are recognised automatically by
     80 .I tar
     81 when reading archives.
     82 This is the default behavior; the flag exists only for backwards compatibility
     83 with older versions of tar.
     84 .TP
     85 .B P
     86 Do not generate the POSIX ustar format.
     87 .TP
     88 .B R
     89 When extracting, ignore leading slash on file names,
     90 i.e., extract all files relative to the current directory.
     91 .TP
     92 .B T
     93 Modifies the behavior of
     94 .B x
     95 to set the modified time
     96 of each file to that specified in the archive.
     97 .TP
     98 .B u
     99 Use the next (numeric) argument as the user id for files in
    100 the output archive.  This is only useful when moving files to
    101 a non-Plan 9 system.
    102 .TP
    103 .B v
    104 (verbose)
    105 Print the name of each file treated
    106 preceded by the function letter.
    107 With 
    108 .BR t ,
    109 give more details about the
    110 archive entries.
    111 .TP
    112 .B z
    113 Operate on compressed tar archives.
    114 The type of compression is inferred from the file name extension:
    115 .MR gzip (1)
    116 for
    117 .B .tar.gz
    118 and
    119 .BR .tgz ;
    120 .I bzip2
    121 (see
    122 .MR gzip (1) )
    123 for
    124 .BR .tar.bz ,
    125 .BR .tbz ,
    126 .BR .tar.bz2 ,
    127 and
    128 .BR .tbz2 ;
    129 .I compress
    130 for
    131 .B .tar.Z
    132 and
    133 .BR .tz .
    134 If no extension matches,
    135 .I gzip
    136 is used.
    137 The
    138 .B z
    139 flag is unnecessary (but allowed) when using the
    140 .B t
    141 and
    142 .B x
    143 verbs on archives with recognized extensions.
    144 .SH EXAMPLES
    145 .I Tar
    146 can be used to copy hierarchies thus:
    147 .IP
    148 .EX
    149 @{cd fromdir && tar cp .} | @{cd todir && tar xT}
    150 .EE
    151 .SH SOURCE
    152 .B \*9/src/cmd/tar.c
    153 .SH SEE ALSO
    154 .I 9ar
    155 in
    156 .MR 9c (1) ,
    157 .MR bundle (1)
    158 .SH BUGS
    159 There is no way to ask for any but the last
    160 occurrence of a file.
    161 .PP
    162 File path names are limited to
    163 100 characters
    164 (256 when using ustar format).
    165 .PP
    166 The tar format allows specification of links and symbolic links,
    167 concepts foreign to Plan 9: they are ignored.