tar 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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, respect leading slash on file names.
  90. By default, files are always extracted 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 as it is processed.
  106. With
  107. .BR t ,
  108. give more details about the
  109. archive entries.
  110. .TP
  111. .B z
  112. Operate on compressed tar archives.
  113. The type of compression is inferred from the file name extension:
  114. .IR gzip (1)
  115. for
  116. .B .tar.gz
  117. and
  118. .BR .tgz ;
  119. .I bzip2
  120. (see
  121. .IR gzip (1))
  122. for
  123. .BR .tar.bz ,
  124. .BR .tbz ,
  125. .BR .tar.bz2 ,
  126. and
  127. .BR .tbz2 ;
  128. .I compress
  129. (not distributed)
  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 /sys/src/cmd/tar.c
  153. .SH SEE ALSO
  154. .IR ar (1),
  155. .IR bundle (1),
  156. .IR tapefs (4)
  157. .SH BUGS
  158. There is no way to ask for any but the last
  159. occurrence of a file.
  160. .PP
  161. File path names are limited to
  162. 100 characters
  163. (256 when using ustar format).
  164. .PP
  165. The tar format allows specification of links and symbolic links,
  166. concepts foreign to Plan 9: they are ignored.
  167. .PP
  168. The
  169. .B r
  170. key (append)
  171. cannot be used on compressed archives.