tar 3.7 KB

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