tar 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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 i
  67. Ignore errors encountered when reading.
  68. Errors writing either produce a corrupt archive
  69. or indicate deeper file system problems.
  70. .TP
  71. .B k
  72. (keep)
  73. Modifies the behavior of
  74. .B x
  75. not to extract files which already exist.
  76. .TP
  77. .B m
  78. Do not set the modification time on extracted files.
  79. This is the default behavior; the flag exists only for compatibility with other tars.
  80. .TP
  81. .B p
  82. Create archive in POSIX ustar format,
  83. which raises the maximum pathname length from 100 to 256 bytes.
  84. Ustar archives are recognised automatically by
  85. .I tar
  86. when reading archives.
  87. This is the default behavior; the flag exists only for backwards compatibility
  88. with older versions of tar.
  89. .TP
  90. .B P
  91. Do not generate the POSIX ustar format.
  92. .TP
  93. .B R
  94. When extracting, respect leading slash on file names.
  95. By default, files are always extracted relative to the current directory.
  96. .TP
  97. .B T
  98. Modifies the behavior of
  99. .B x
  100. to set the modified time
  101. of each file to that specified in the archive.
  102. .TP
  103. .B u
  104. Use the next (numeric) argument as the user id for files in
  105. the output archive. This is only useful when moving files to
  106. a non-Plan 9 system.
  107. .TP
  108. .B v
  109. (verbose)
  110. Print the name of each file as it is processed.
  111. With
  112. .BR t ,
  113. give more details about the
  114. archive entries.
  115. .TP
  116. .B z
  117. Operate on compressed tar archives.
  118. The type of compression is inferred from the file name extension:
  119. .IR gzip (1)
  120. for
  121. .B .tar.gz
  122. and
  123. .BR .tgz ;
  124. .I bzip2
  125. (see
  126. .IR gzip (1))
  127. for
  128. .BR .tar.bz ,
  129. .BR .tbz ,
  130. .BR .tar.bz2 ,
  131. and
  132. .BR .tbz2 ;
  133. .I compress
  134. (not distributed)
  135. for
  136. .B .tar.Z
  137. and
  138. .BR .tz .
  139. If no extension matches,
  140. .I gzip
  141. is used.
  142. The
  143. .B z
  144. flag is unnecessary (but allowed) when using the
  145. .B t
  146. and
  147. .B x
  148. verbs on archives with recognized extensions.
  149. .SH EXAMPLES
  150. .I Tar
  151. can be used to copy hierarchies thus:
  152. .IP
  153. .EX
  154. @{cd fromdir && tar cp .} | @{cd todir && tar xT}
  155. .EE
  156. .SH SOURCE
  157. .B /sys/src/cmd/tar.c
  158. .SH SEE ALSO
  159. .IR ar (1),
  160. .IR bundle (1),
  161. .IR tapefs (4)
  162. .SH BUGS
  163. There is no way to ask for any but the last
  164. occurrence of a file.
  165. .PP
  166. File path names are limited to
  167. 100 characters
  168. (256 when using ustar format).
  169. .PP
  170. The tar format allows specification of links and symbolic links,
  171. concepts foreign to Plan 9: they are ignored.
  172. .PP
  173. The
  174. .B r
  175. key (append)
  176. cannot be used on compressed archives.