1
0

tar 3.9 KB

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