bsdtar.1.html 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427
  1. <!-- Creator : groff version 1.22.4 -->
  2. <!-- CreationDate: Tue Jul 18 07:11:07 2023 -->
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  4. "http://www.w3.org/TR/html4/loose.dtd">
  5. <html>
  6. <head>
  7. <meta name="generator" content="groff -Thtml, see www.gnu.org">
  8. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  9. <meta name="Content-Style" content="text/css">
  10. <style type="text/css">
  11. p { margin-top: 0; margin-bottom: 0; vertical-align: top }
  12. pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
  13. table { margin-top: 0; margin-bottom: 0; vertical-align: top }
  14. h1 { text-align: center }
  15. </style>
  16. <title></title>
  17. </head>
  18. <body>
  19. <hr>
  20. <p>TAR(1) BSD General Commands Manual TAR(1)</p>
  21. <p style="margin-top: 1em"><b>NAME</b></p>
  22. <p style="margin-left:6%;"><b>tar</b> &mdash; manipulate
  23. tape archives</p>
  24. <p style="margin-top: 1em"><b>SYNOPSIS</b></p>
  25. <p style="margin-left:12%;"><b>tar</b>
  26. [<i>bundled-flags&nbsp;</i>&lang;</p>
  27. <p>args &rang; ] [&lang; <i><br>
  28. file</i> &rang; &nbsp;|&nbsp;&lang; <i><br>
  29. pattern</i> &rang; &nbsp;...]</p>
  30. <p style="margin-left:12%;"><b>tar</b> {<b>-c</b>}
  31. [<i>options</i>]
  32. [<i>files&nbsp;</i>|&nbsp;<i>directories</i>] <b><br>
  33. tar</b> {<b>-r&nbsp;</b>|&nbsp;<b>-u</b>} <b>-f</b>
  34. <i>archive-file</i> [<i>options</i>]
  35. [<i>files&nbsp;</i>|&nbsp;<i>directories</i>] <b><br>
  36. tar</b> {<b>-t&nbsp;</b>|&nbsp;<b>-x</b>} [<i>options</i>]
  37. [<i>patterns</i>]</p>
  38. <p style="margin-top: 1em"><b>DESCRIPTION</b></p>
  39. <p style="margin-left:6%;"><b>tar</b> creates and
  40. manipulates streaming archive files. This implementation can
  41. extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip,
  42. and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
  43. zip, 7-zip, and shar archives.</p>
  44. <p style="margin-left:6%; margin-top: 1em">The first
  45. synopsis form shows a &ldquo;bundled&rdquo; option word.
  46. This usage is provided for compatibility with historical
  47. implementations. See COMPATIBILITY below for details.</p>
  48. <p style="margin-left:6%; margin-top: 1em">The other
  49. synopsis forms show the preferred usage. The first option to
  50. <b>tar</b> is a mode indicator from the following list:</p>
  51. <p><b>-c</b></p>
  52. <p style="margin-left:17%; margin-top: 1em">Create a new
  53. archive containing the specified items. The long option form
  54. is <b>--create</b>.</p>
  55. <p><b>-r</b></p>
  56. <p style="margin-left:17%; margin-top: 1em">Like <b>-c</b>,
  57. but new entries are appended to the archive. Note that this
  58. only works on uncompressed archives stored in regular files.
  59. The <b>-f</b> option is required. The long option form is
  60. <b>--append</b>.</p>
  61. <p><b>-t</b></p>
  62. <p style="margin-left:17%; margin-top: 1em">List archive
  63. contents to stdout. The long option form is
  64. <b>--list</b>.</p>
  65. <p><b>-u</b></p>
  66. <p style="margin-left:17%; margin-top: 1em">Like <b>-r</b>,
  67. but new entries are added only if they have a modification
  68. date newer than the corresponding entry in the archive. Note
  69. that this only works on uncompressed archives stored in
  70. regular files. The <b>-f</b> option is required. The long
  71. form is <b>--update</b>.</p>
  72. <p><b>-x</b></p>
  73. <p style="margin-left:17%; margin-top: 1em">Extract to disk
  74. from the archive. If a file with the same name appears more
  75. than once in the archive, each copy will be extracted, with
  76. later copies overwriting (replacing) earlier copies. The
  77. long option form is <b>--extract</b>.</p>
  78. <p style="margin-left:6%; margin-top: 1em">In <b>-c</b>,
  79. <b>-r</b>, or <b>-u</b> mode, each specified file or
  80. directory is added to the archive in the order specified on
  81. the command line. By default, the contents of each directory
  82. are also archived.</p>
  83. <p style="margin-left:6%; margin-top: 1em">In extract or
  84. list mode, the entire command line is read and parsed before
  85. the archive is opened. The pathnames or patterns on the
  86. command line indicate which items in the archive should be
  87. processed. Patterns are shell-style globbing patterns as
  88. documented in tcsh(1).</p>
  89. <p style="margin-top: 1em"><b>OPTIONS</b></p>
  90. <p style="margin-left:6%;">Unless specifically stated
  91. otherwise, options are applicable in all operating
  92. modes.</p>
  93. <p style="margin-top: 1em"><b>@</b><i>archive</i></p>
  94. <p style="margin-left:17%;">(c and r modes only) The
  95. specified archive is opened and the entries in it will be
  96. appended to the current archive. As a simple example,</p>
  97. <p style="margin-left:24%;"><b>tar -c -f</b> <i>-
  98. newfile</i> <b>@</b><i>original.tar</i></p>
  99. <p style="margin-left:17%;">writes a new archive to
  100. standard output containing a file <i>newfile</i> and all of
  101. the entries from <i>original.tar</i>. In contrast,</p>
  102. <p style="margin-left:24%;"><b>tar -c -f</b> <i>- newfile
  103. original.tar</i></p>
  104. <p style="margin-left:17%;">creates a new archive with only
  105. two entries. Similarly,</p>
  106. <p style="margin-left:24%;"><b>tar -czf</b> <i>-</i>
  107. <b>--format pax @</b><i>-</i></p>
  108. <p style="margin-left:17%;">reads an archive from standard
  109. input (whose format will be determined automatically) and
  110. converts it into a gzip-compressed pax-format archive on
  111. stdout. In this way, <b>tar</b> can be used to convert
  112. archives from one format to another.</p>
  113. <p style="margin-top: 1em"><b>-a</b>,
  114. <b>--auto-compress</b></p>
  115. <p style="margin-left:17%;">(c mode only) Use the archive
  116. suffix to decide a set of the format and the compressions.
  117. As a simple example,</p>
  118. <p style="margin-left:24%;"><b>tar -a -cf</b>
  119. <i>archive.tgz source.c source.h</i></p>
  120. <p style="margin-left:17%;">creates a new archive with
  121. restricted pax format and gzip compression,</p>
  122. <p style="margin-left:24%;"><b>tar -a -cf</b>
  123. <i>archive.tar.bz2.uu source.c source.h</i></p>
  124. <p style="margin-left:17%;">creates a new archive with
  125. restricted pax format and bzip2 compression and uuencode
  126. compression,</p>
  127. <p style="margin-left:24%;"><b>tar -a -cf</b>
  128. <i>archive.zip source.c source.h</i></p>
  129. <p style="margin-left:17%;">creates a new archive with zip
  130. format,</p>
  131. <p style="margin-left:24%;"><b>tar -a -jcf</b>
  132. <i>archive.tgz source.c source.h</i></p>
  133. <p style="margin-left:17%;">ignores the &ldquo;-j&rdquo;
  134. option, and creates a new archive with restricted pax format
  135. and gzip compression,</p>
  136. <p style="margin-left:24%;"><b>tar -a -jcf</b>
  137. <i>archive.xxx source.c source.h</i></p>
  138. <p style="margin-left:17%;">if it is unknown suffix or no
  139. suffix, creates a new archive with restricted pax format and
  140. bzip2 compression.</p>
  141. <p style="margin-top: 1em"><b>--acls</b></p>
  142. <p style="margin-left:17%; margin-top: 1em">(c, r, u, x
  143. modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This
  144. is the reverse of <b>--no-acls</b> and the default behavior
  145. in c, r, and u modes (except on Mac OS X) or if <b>tar</b>
  146. is run in x mode as root. On Mac OS X this option translates
  147. extended ACLs to NFSv4 ACLs. To store extended ACLs the
  148. <b>--mac-metadata</b> option is preferred.</p>
  149. <p style="margin-top: 1em"><b>-B</b>,
  150. <b>--read-full-blocks</b></p>
  151. <p style="margin-left:17%;">Ignored for compatibility with
  152. other tar(1) implementations.</p>
  153. <p style="margin-top: 1em"><b>-b</b> <i>blocksize</i>,
  154. <b>--block-size</b> <i>blocksize</i></p>
  155. <p style="margin-left:17%;">Specify the block size, in
  156. 512-byte records, for tape drive I/O. As a rule, this
  157. argument is only needed when reading from or writing to tape
  158. drives, and usually not even then as the default block size
  159. of 20 records (10240 bytes) is very common.</p>
  160. <p style="margin-top: 1em"><b>-C</b> <i>directory</i>,
  161. <b>--cd</b> <i>directory</i>, <b>--directory</b>
  162. <i>directory</i></p>
  163. <p style="margin-left:17%;">In c and r mode, this changes
  164. the directory before adding the following files. In x mode,
  165. change directories after opening the archive but before
  166. extracting entries from the archive.</p>
  167. <p style="margin-top: 1em"><b>--chroot</b></p>
  168. <p style="margin-left:17%;">(x mode only) <b>chroot</b>()
  169. to the current directory after processing any <b>-C</b>
  170. options and before extracting any files.</p>
  171. <p style="margin-top: 1em"><b>--clear-nochange-fflags</b></p>
  172. <p style="margin-left:17%;">(x mode only) Before removing
  173. file system objects to replace them, clear platform-specific
  174. file attributes or file flags that might prevent
  175. removal.</p>
  176. <p style="margin-top: 1em"><b>--exclude</b>
  177. <i>pattern</i></p>
  178. <p style="margin-left:17%;">Do not process files or
  179. directories that match the specified pattern. Note that
  180. exclusions take precedence over patterns or filenames
  181. specified on the command line.</p>
  182. <p style="margin-top: 1em"><b>--exclude-vcs</b></p>
  183. <p style="margin-left:17%;">Do not process files or
  184. directories internally used by the version control systems
  185. &rsquo;Arch&rsquo;, &rsquo;Bazaar&rsquo;, &rsquo;CVS&rsquo;,
  186. &rsquo;Darcs&rsquo;, &rsquo;Mercurial&rsquo;,
  187. &rsquo;RCS&rsquo;, &rsquo;SCCS&rsquo;, &rsquo;SVN&rsquo; and
  188. &rsquo;git&rsquo;.</p>
  189. <p style="margin-top: 1em"><b>--fflags</b></p>
  190. <p style="margin-left:17%;">(c, r, u, x modes only) Archive
  191. or extract platform-specific file attributes or file flags.
  192. This is the reverse of <b>--no-fflags</b> and the default
  193. behavior in c, r, and u modes or if <b>tar</b> is run in x
  194. mode as root.</p>
  195. <p style="margin-top: 1em"><b>--format</b>
  196. <i>format</i></p>
  197. <p style="margin-left:17%;">(c, r, u mode only) Use the
  198. specified format for the created archive. Supported formats
  199. include &ldquo;cpio&rdquo;, &ldquo;pax&rdquo;,
  200. &ldquo;shar&rdquo;, and &ldquo;ustar&rdquo;. Other formats
  201. may also be supported; see libarchive-formats(5) for more
  202. information about currently-supported formats. In r and u
  203. modes, when extending an existing archive, the format
  204. specified here must be compatible with the format of the
  205. existing archive on disk.</p>
  206. <p style="margin-top: 1em"><b>-f</b> <i>file</i>,
  207. <b>--file</b> <i>file</i></p>
  208. <p style="margin-left:17%;">Read the archive from or write
  209. the archive to the specified file. The filename can be
  210. <i>-</i> for standard input or standard output. The default
  211. varies by system; on FreeBSD, the default is
  212. <i>/dev/sa0</i>; on Linux, the default is
  213. <i>/dev/st0</i>.</p>
  214. <p style="margin-top: 1em"><b>--gid</b> <i>id</i></p>
  215. <p style="margin-left:17%;">Use the provided group id
  216. number. On extract, this overrides the group id in the
  217. archive; the group name in the archive will be ignored. On
  218. create, this overrides the group id read from disk; if
  219. <b>--gname</b> is not also specified, the group name will be
  220. set to match the group id.</p>
  221. <p style="margin-top: 1em"><b>--gname</b> <i>name</i></p>
  222. <p style="margin-left:17%;">Use the provided group name. On
  223. extract, this overrides the group name in the archive; if
  224. the provided group name does not exist on the system, the
  225. group id (from the archive or from the <b>--gid</b> option)
  226. will be used instead. On create, this sets the group name
  227. that will be stored in the archive; the name will not be
  228. verified against the system group database.</p>
  229. <p style="margin-top: 1em"><b>-H</b></p>
  230. <p style="margin-left:17%; margin-top: 1em">(c and r modes
  231. only) Symbolic links named on the command line will be
  232. followed; the target of the link will be archived, not the
  233. link itself.</p>
  234. <p style="margin-top: 1em"><b>-h</b></p>
  235. <p style="margin-left:17%; margin-top: 1em">(c and r modes
  236. only) Synonym for <b>-L</b>.</p>
  237. <p style="margin-top: 1em"><b>-I</b></p>
  238. <p style="margin-left:17%; margin-top: 1em">Synonym for
  239. <b>-T</b>.</p>
  240. <p style="margin-top: 1em"><b>--help</b></p>
  241. <p style="margin-left:17%; margin-top: 1em">Show usage.</p>
  242. <p style="margin-top: 1em"><b>--hfsCompression</b></p>
  243. <p style="margin-left:17%;">(x mode only) Mac OS X specific
  244. (v10.6 or later). Compress extracted regular files with HFS+
  245. compression.</p>
  246. <p style="margin-top: 1em"><b>--ignore-zeros</b></p>
  247. <p style="margin-left:17%;">An alias of <b>--options
  248. read_concatenated_archives</b> for compatibility with GNU
  249. tar.</p>
  250. <p style="margin-top: 1em"><b>--include</b>
  251. <i>pattern</i></p>
  252. <p style="margin-left:17%;">Process only files or
  253. directories that match the specified pattern. Note that
  254. exclusions specified with <b>--exclude</b> take precedence
  255. over inclusions. If no inclusions are explicitly specified,
  256. all entries are processed by default. The <b>--include</b>
  257. option is especially useful when filtering archives. For
  258. example, the command</p>
  259. <p style="margin-left:24%;"><b>tar -c -f</b> <i>new.tar</i>
  260. <b>--include=&rsquo;*foo*&rsquo; @</b><i>old.tgz</i></p>
  261. <p style="margin-left:17%;">creates a new archive
  262. <i>new.tar</i> containing only the entries from
  263. <i>old.tgz</i> containing the string &rsquo;foo&rsquo;.</p>
  264. <p style="margin-top: 1em"><b>-J</b>, <b>--xz</b></p>
  265. <p style="margin-left:17%;">(c mode only) Compress the
  266. resulting archive with xz(1). In extract or list modes, this
  267. option is ignored. Note that this <b>tar</b> implementation
  268. recognizes XZ compression automatically when reading
  269. archives.</p>
  270. <p style="margin-top: 1em"><b>-j</b>, <b>--bzip</b>,
  271. <b>--bzip2</b>, <b>--bunzip2</b></p>
  272. <p style="margin-left:17%;">(c mode only) Compress the
  273. resulting archive with bzip2(1). In extract or list modes,
  274. this option is ignored. Note that this <b>tar</b>
  275. implementation recognizes bzip2 compression automatically
  276. when reading archives.</p>
  277. <p style="margin-top: 1em"><b>-k</b>,
  278. <b>--keep-old-files</b></p>
  279. <p style="margin-left:17%;">(x mode only) Do not overwrite
  280. existing files. In particular, if a file appears more than
  281. once in an archive, later copies will not overwrite earlier
  282. copies.</p>
  283. <p style="margin-top: 1em"><b>--keep-newer-files</b></p>
  284. <p style="margin-left:17%;">(x mode only) Do not overwrite
  285. existing files that are newer than the versions appearing in
  286. the archive being extracted.</p>
  287. <p style="margin-top: 1em"><b>-L</b>,
  288. <b>--dereference</b></p>
  289. <p style="margin-left:17%;">(c and r modes only) All
  290. symbolic links will be followed. Normally, symbolic links
  291. are archived as such. With this option, the target of the
  292. link will be archived instead.</p>
  293. <p style="margin-top: 1em"><b>-l</b>,
  294. <b>--check-links</b></p>
  295. <p style="margin-left:17%;">(c and r modes only) Issue a
  296. warning message unless all links to each file are
  297. archived.</p>
  298. <p style="margin-top: 1em"><b>--lrzip</b></p>
  299. <p style="margin-left:17%;">(c mode only) Compress the
  300. resulting archive with lrzip(1). In extract or list modes,
  301. this option is ignored. Note that this <b>tar</b>
  302. implementation recognizes lrzip compression automatically
  303. when reading archives.</p>
  304. <p style="margin-top: 1em"><b>--lz4</b></p>
  305. <p style="margin-left:17%; margin-top: 1em">(c mode only)
  306. Compress the archive with lz4-compatible compression before
  307. writing it. In extract or list modes, this option is
  308. ignored. Note that this <b>tar</b> implementation recognizes
  309. lz4 compression automatically when reading archives.</p>
  310. <p style="margin-top: 1em"><b>--zstd</b></p>
  311. <p style="margin-left:17%; margin-top: 1em">(c mode only)
  312. Compress the archive with zstd-compatible compression before
  313. writing it. In extract or list modes, this option is
  314. ignored. Note that this <b>tar</b> implementation recognizes
  315. zstd compression automatically when reading archives.</p>
  316. <p style="margin-top: 1em"><b>--lzma</b></p>
  317. <p style="margin-left:17%; margin-top: 1em">(c mode only)
  318. Compress the resulting archive with the original LZMA
  319. algorithm. In extract or list modes, this option is ignored.
  320. Use of this option is discouraged and new archives should be
  321. created with <b>--xz</b> instead. Note that this <b>tar</b>
  322. implementation recognizes LZMA compression automatically
  323. when reading archives.</p>
  324. <p style="margin-top: 1em"><b>--lzop</b></p>
  325. <p style="margin-left:17%; margin-top: 1em">(c mode only)
  326. Compress the resulting archive with lzop(1). In extract or
  327. list modes, this option is ignored. Note that this
  328. <b>tar</b> implementation recognizes LZO compression
  329. automatically when reading archives.</p>
  330. <p style="margin-top: 1em"><b>-m</b>,
  331. <b>--modification-time</b></p>
  332. <p style="margin-left:17%;">(x mode only) Do not extract
  333. modification time. By default, the modification time is set
  334. to the time stored in the archive.</p>
  335. <p style="margin-top: 1em"><b>--mac-metadata</b></p>
  336. <p style="margin-left:17%;">(c, r, u and x mode only) Mac
  337. OS X specific. Archive or extract extended ACLs and extended
  338. file attributes using copyfile(3) in AppleDouble format.
  339. This is the reverse of <b>--no-mac-metadata</b>. and the
  340. default behavior in c, r, and u modes or if <b>tar</b> is
  341. run in x mode as root.</p>
  342. <p style="margin-top: 1em"><b>-n</b>, <b>--norecurse</b>,
  343. <b>--no-recursion</b></p>
  344. <p style="margin-left:17%;">Do not operate recursively on
  345. the content of directories.</p>
  346. <p style="margin-top: 1em"><b>--newer</b> <i>date</i></p>
  347. <p style="margin-left:17%;">(c, r, u modes only) Only
  348. include files and directories newer than the specified date.
  349. This compares ctime entries.</p>
  350. <p style="margin-top: 1em"><b>--newer-mtime</b>
  351. <i>date</i></p>
  352. <p style="margin-left:17%;">(c, r, u modes only) Like
  353. <b>--newer</b>, except it compares mtime entries instead of
  354. ctime entries.</p>
  355. <p style="margin-top: 1em"><b>--newer-than</b>
  356. <i>file</i></p>
  357. <p style="margin-left:17%;">(c, r, u modes only) Only
  358. include files and directories newer than the specified file.
  359. This compares ctime entries.</p>
  360. <p style="margin-top: 1em"><b>--newer-mtime-than</b>
  361. <i>file</i></p>
  362. <p style="margin-left:17%;">(c, r, u modes only) Like
  363. <b>--newer-than</b>, except it compares mtime entries
  364. instead of ctime entries.</p>
  365. <p style="margin-top: 1em"><b>--nodump</b></p>
  366. <p style="margin-left:17%;">(c and r modes only) Honor the
  367. nodump file flag by skipping this file.</p>
  368. <p style="margin-top: 1em"><b>--nopreserveHFSCompression</b></p>
  369. <p style="margin-left:17%;">(x mode only) Mac OS X specific
  370. (v10.6 or later). Do not compress extracted regular files
  371. which were compressed with HFS+ compression before archived.
  372. By default, compress the regular files again with HFS+
  373. compression.</p>
  374. <p style="margin-top: 1em"><b>--null</b></p>
  375. <p style="margin-left:17%; margin-top: 1em">(use with
  376. <b>-I</b> or <b>-T</b>) Filenames or patterns are separated
  377. by null characters, not by newlines. This is often used to
  378. read filenames output by the <b>-print0</b> option to
  379. find(1).</p>
  380. <p style="margin-top: 1em"><b>--no-acls</b></p>
  381. <p style="margin-left:17%;">(c, r, u, x modes only) Do not
  382. archive or extract POSIX.1e or NFSv4 ACLs. This is the
  383. reverse of <b>--acls</b> and the default behavior if
  384. <b>tar</b> is run as non-root in x mode (on Mac OS X as any
  385. user in c, r, u and x modes).</p>
  386. <p style="margin-top: 1em"><b>--no-fflags</b></p>
  387. <p style="margin-left:17%;">(c, r, u, x modes only) Do not
  388. archive or extract file attributes or file flags. This is
  389. the reverse of <b>--fflags</b> and the default behavior if
  390. <b>tar</b> is run as non-root in x mode.</p>
  391. <p style="margin-top: 1em"><b>--no-mac-metadata</b></p>
  392. <p style="margin-left:17%;">(x mode only) Mac OS X
  393. specific. Do not archive or extract ACLs and extended file
  394. attributes using copyfile(3) in AppleDouble format. This is
  395. the reverse of <b>--mac-metadata</b>. and the default
  396. behavior if <b>tar</b> is run as non-root in x mode.</p>
  397. <p style="margin-top: 1em"><b>--no-read-sparse</b></p>
  398. <p style="margin-left:17%;">(c, r, u modes only) Do not
  399. read sparse file information from disk. This is the reverse
  400. of <b>--read-sparse</b>.</p>
  401. <p style="margin-top: 1em"><b>--no-safe-writes</b></p>
  402. <p style="margin-left:17%;">(x mode only) Do not create
  403. temporary files and use rename(2) to replace the original
  404. ones. This is the reverse of <b>--safe-writes</b>.</p>
  405. <p style="margin-top: 1em"><b>--no-same-owner</b></p>
  406. <p style="margin-left:17%;">(x mode only) Do not extract
  407. owner and group IDs. This is the reverse of
  408. <b>--same-owner</b> and the default behavior if <b>tar</b>
  409. is run as non-root.</p>
  410. <p style="margin-top: 1em"><b>--no-same-permissions</b></p>
  411. <p style="margin-left:17%;">(x mode only) Do not extract
  412. full permissions (SGID, SUID, sticky bit, file attributes or
  413. file flags, extended file attributes and ACLs). This is the
  414. reverse of <b>-p</b> and the default behavior if <b>tar</b>
  415. is run as non-root.</p>
  416. <p style="margin-top: 1em"><b>--no-xattrs</b></p>
  417. <p style="margin-left:17%;">(c, r, u, x modes only) Do not
  418. archive or extract extended file attributes. This is the
  419. reverse of <b>--xattrs</b> and the default behavior if
  420. <b>tar</b> is run as non-root in x mode.</p>
  421. <p style="margin-top: 1em"><b>--numeric-owner</b></p>
  422. <p style="margin-left:17%;">This is equivalent to
  423. <b>--uname</b> &quot;&quot; <b>--gname</b> &quot;&quot;. On
  424. extract, it causes user and group names in the archive to be
  425. ignored in favor of the numeric user and group ids. On
  426. create, it causes user and group names to not be stored in
  427. the archive.</p>
  428. <p style="margin-top: 1em"><b>-O</b>,
  429. <b>--to-stdout</b></p>
  430. <p style="margin-left:17%;">(x, t modes only) In extract
  431. (-x) mode, files will be written to standard out rather than
  432. being extracted to disk. In list (-t) mode, the file listing
  433. will be written to stderr rather than the usual stdout.</p>
  434. <p style="margin-top: 1em"><b>-o</b></p>
  435. <p style="margin-left:17%; margin-top: 1em">(x mode) Use
  436. the user and group of the user running the program rather
  437. than those specified in the archive. Note that this has no
  438. significance unless <b>-p</b> is specified, and the program
  439. is being run by the root user. In this case, the file modes
  440. and flags from the archive will be restored, but ACLs or
  441. owner information in the archive will be discarded.</p>
  442. <p style="margin-top: 1em"><b>-o</b></p>
  443. <p style="margin-left:17%; margin-top: 1em">(c, r, u mode)
  444. A synonym for <b>--format</b> <i>ustar</i></p>
  445. <p style="margin-top: 1em"><b>--older</b> <i>date</i></p>
  446. <p style="margin-left:17%;">(c, r, u modes only) Only
  447. include files and directories older than the specified date.
  448. This compares ctime entries.</p>
  449. <p style="margin-top: 1em"><b>--older-mtime</b>
  450. <i>date</i></p>
  451. <p style="margin-left:17%;">(c, r, u modes only) Like
  452. <b>--older</b>, except it compares mtime entries instead of
  453. ctime entries.</p>
  454. <p style="margin-top: 1em"><b>--older-than</b>
  455. <i>file</i></p>
  456. <p style="margin-left:17%;">(c, r, u modes only) Only
  457. include files and directories older than the specified file.
  458. This compares ctime entries.</p>
  459. <p style="margin-top: 1em"><b>--older-mtime-than</b>
  460. <i>file</i></p>
  461. <p style="margin-left:17%;">(c, r, u modes only) Like
  462. <b>--older-than</b>, except it compares mtime entries
  463. instead of ctime entries.</p>
  464. <p style="margin-top: 1em"><b>--one-file-system</b></p>
  465. <p style="margin-left:17%;">(c, r, and u modes) Do not
  466. cross mount points.</p>
  467. <p style="margin-top: 1em"><b>--options</b>
  468. <i>options</i></p>
  469. <p style="margin-left:17%;">Select optional behaviors for
  470. particular modules. The argument is a text string containing
  471. comma-separated keywords and values. These are passed to the
  472. modules that handle particular formats to control how those
  473. formats will behave. Each option has one of the following
  474. forms:</p>
  475. <p><i>key=value</i></p>
  476. <p style="margin-left:27%;">The key will be set to the
  477. specified value in every module that supports it. Modules
  478. that do not support this key will ignore it.</p>
  479. <p><i>key</i></p>
  480. <p style="margin-left:27%; margin-top: 1em">The key will be
  481. enabled in every module that supports it. This is equivalent
  482. to <i>key</i><b>=1</b>.</p>
  483. <p><i>!key</i></p>
  484. <p style="margin-left:27%; margin-top: 1em">The key will be
  485. disabled in every module that supports it.</p>
  486. <p><i>module:key=value</i>, <i>module:key</i>,
  487. <i>module:!key</i></p>
  488. <p style="margin-left:27%;">As above, but the corresponding
  489. key and value will be provided only to modules whose name
  490. matches <i>module</i>.</p>
  491. <p style="margin-left:17%; margin-top: 1em">The complete
  492. list of supported modules and keys for create and append
  493. modes is in archive_write_set_options(3) and for extract and
  494. list modes in archive_read_set_options(3).</p>
  495. <p style="margin-left:17%; margin-top: 1em">Examples of
  496. supported options:</p>
  497. <p><b>iso9660:joliet</b></p>
  498. <p style="margin-left:27%;">Support Joliet extensions. This
  499. is enabled by default, use <b>!joliet</b> or
  500. <b>iso9660:!joliet</b> to disable.</p>
  501. <p><b>iso9660:rockridge</b></p>
  502. <p style="margin-left:27%;">Support Rock Ridge extensions.
  503. This is enabled by default, use <b>!rockridge</b> or
  504. <b>iso9660:!rockridge</b> to disable.</p>
  505. <p><b>gzip:compression-level</b></p>
  506. <p style="margin-left:27%;">A decimal integer from 1 to 9
  507. specifying the gzip compression level.</p>
  508. <p><b>gzip:timestamp</b></p>
  509. <p style="margin-left:27%;">Store timestamp. This is
  510. enabled by default, use <b>!timestamp</b> or
  511. <b>gzip:!timestamp</b> to disable.</p>
  512. <p><b>lrzip:compression</b>=<i>type</i></p>
  513. <p style="margin-left:27%;">Use <i>type</i> as compression
  514. method. Supported values are bzip2, gzip, lzo (ultra fast),
  515. and zpaq (best, extremely slow).</p>
  516. <p><b>lrzip:compression-level</b></p>
  517. <p style="margin-left:27%;">A decimal integer from 1 to 9
  518. specifying the lrzip compression level.</p>
  519. <p><b>lz4:compression-level</b></p>
  520. <p style="margin-left:27%;">A decimal integer from 1 to 9
  521. specifying the lzop compression level.</p>
  522. <p><b>lz4:stream-checksum</b></p>
  523. <p style="margin-left:27%;">Enable stream checksum. This is
  524. by default, use <b>lz4:!stream-checksum</b> to disable.</p>
  525. <p><b>lz4:block-checksum</b></p>
  526. <p style="margin-left:27%;">Enable block checksum (Disabled
  527. by default).</p>
  528. <p><b>lz4:block-size</b></p>
  529. <p style="margin-left:27%;">A decimal integer from 4 to 7
  530. specifying the lz4 compression block size (7 is set by
  531. default).</p>
  532. <p><b>lz4:block-dependence</b></p>
  533. <p style="margin-left:27%;">Use the previous block of the
  534. block being compressed for a compression dictionary to
  535. improve compression ratio.</p>
  536. <p><b>zstd:compression-level</b></p>
  537. <p style="margin-left:27%;">A decimal integer specifying
  538. the zstd compression level. Supported values depend on the
  539. library version, common values are from 1 to 22.</p>
  540. <p><b>zstd:threads</b></p>
  541. <p style="margin-left:27%;">Specify the number of worker
  542. threads to use. Setting threads to a special value 0 makes
  543. zstd(1) use as many threads as there are CPU cores on the
  544. system.</p>
  545. <p><b>zstd:frame-per-file</b></p>
  546. <p style="margin-left:27%;">Start a new compression frame
  547. at the beginning of each file in the archive.</p>
  548. <p><b>zstd:min-frame-size</b>=<i>N</i></p>
  549. <p style="margin-left:27%;">In combination with
  550. <b>zstd:frame-per-file</b>, do not start a new compression
  551. frame unless the current frame is at least <i>N</i>
  552. bytes.</p>
  553. <p><b>zstd:max-frame-size</b>=<i>N</i></p>
  554. <p style="margin-left:27%;">Start a new compression frame
  555. as soon as the current frame exceeds <i>N</i> bytes.</p>
  556. <p><b>lzop:compression-level</b></p>
  557. <p style="margin-left:27%;">A decimal integer from 1 to 9
  558. specifying the lzop compression level.</p>
  559. <p><b>xz:compression-level</b></p>
  560. <p style="margin-left:27%;">A decimal integer from 0 to 9
  561. specifying the xz compression level.</p>
  562. <p><b>xz:threads</b></p>
  563. <p style="margin-left:27%;">Specify the number of worker
  564. threads to use. Setting threads to a special value 0 makes
  565. xz(1) use as many threads as there are CPU cores on the
  566. system.</p>
  567. <p><b>mtree:</b><i>keyword</i></p>
  568. <p style="margin-left:27%;">The mtree writer module allows
  569. you to specify which mtree keywords will be included in the
  570. output. Supported keywords include: <b>cksum</b>,
  571. <b>device</b>, <b>flags</b>, <b>gid</b>, <b>gname</b>,
  572. <b>indent</b>, <b>link</b>, <b>md5</b>, <b>mode</b>,
  573. <b>nlink</b>, <b>rmd160</b>, <b>sha1</b>, <b>sha256</b>,
  574. <b>sha384</b>, <b>sha512</b>, <b>size</b>, <b>time</b>,
  575. <b>uid</b>, <b>uname</b>. The default is equivalent to:
  576. &ldquo;device, flags, gid, gname, link, mode, nlink, size,
  577. time, type, uid, uname&rdquo;.</p>
  578. <p><b>mtree:all</b></p>
  579. <p style="margin-left:27%;">Enables all of the above
  580. keywords. You can also use <b>mtree:!all</b> to disable all
  581. keywords.</p>
  582. <p><b>mtree:use-set</b></p>
  583. <p style="margin-left:27%;">Enable generation of
  584. <b>/set</b> lines in the output.</p>
  585. <p><b>mtree:indent</b></p>
  586. <p style="margin-left:27%;">Produce human-readable output
  587. by indenting options and splitting lines to fit into 80
  588. columns.</p>
  589. <p><b>zip:compression</b>=<i>type</i></p>
  590. <p style="margin-left:27%;">Use <i>type</i> as compression
  591. method. Supported values are store (uncompressed) and
  592. deflate (gzip algorithm).</p>
  593. <p><b>zip:encryption</b></p>
  594. <p style="margin-left:27%;">Enable encryption using
  595. traditional zip encryption.</p>
  596. <p><b>zip:encryption</b>=<i>type</i></p>
  597. <p style="margin-left:27%;">Use <i>type</i> as encryption
  598. type. Supported values are zipcrypt (traditional zip
  599. encryption), aes128 (WinZip AES-128 encryption) and aes256
  600. (WinZip AES-256 encryption).</p>
  601. <p><b>read_concatenated_archives</b></p>
  602. <p style="margin-left:27%;">Ignore zeroed blocks in the
  603. archive, which occurs when multiple tar archives have been
  604. concatenated together. Without this option, only the
  605. contents of the first concatenated archive would be read.
  606. This option is comparable to the <b>-i</b>,
  607. <b>--ignore-zeros</b> option of GNU tar.</p>
  608. <p style="margin-left:17%;">If a provided option is not
  609. supported by any module, that is a fatal error.</p>
  610. <p style="margin-top: 1em"><b>-P</b>,
  611. <b>--absolute-paths</b></p>
  612. <p style="margin-left:17%;">Preserve pathnames. By default,
  613. absolute pathnames (those that begin with a / character)
  614. have the leading slash removed both when creating archives
  615. and extracting from them. Also, <b>tar</b> will refuse to
  616. extract archive entries whose pathnames contain <i>..</i> or
  617. whose target directory would be altered by a symlink. This
  618. option suppresses these behaviors.</p>
  619. <p style="margin-top: 1em"><b>-p</b>, <b>--insecure</b>,
  620. <b>--preserve-permissions</b></p>
  621. <p style="margin-left:17%;">(x mode only) Preserve file
  622. permissions. Attempt to restore the full permissions,
  623. including file modes, file attributes or file flags,
  624. extended file attributes and ACLs, if available, for each
  625. item extracted from the archive. This is the reverse of
  626. <b>--no-same-permissions</b> and the default if <b>tar</b>
  627. is being run as root. It can be partially overridden by also
  628. specifying <b>--no-acls</b>, <b>--no-fflags</b>,
  629. <b>--no-mac-metadata</b> or <b>--no-xattrs</b>.</p>
  630. <p style="margin-top: 1em"><b>--passphrase</b>
  631. <i>passphrase</i></p>
  632. <p style="margin-left:17%;">The <i>passphrase</i> is used
  633. to extract or create an encrypted archive. Currently, zip is
  634. the only supported format that supports encryption. You
  635. shouldn&rsquo;t use this option unless you realize how
  636. insecure use of this option is.</p>
  637. <p style="margin-top: 1em"><b>--posix</b></p>
  638. <p style="margin-left:17%;">(c, r, u mode only) Synonym for
  639. <b>--format</b> <i>pax</i></p>
  640. <p style="margin-top: 1em"><b>-q</b>,
  641. <b>--fast-read</b></p>
  642. <p style="margin-left:17%;">(x and t mode only) Extract or
  643. list only the first archive entry that matches each pattern
  644. or filename operand. Exit as soon as each specified pattern
  645. or filename has been matched. By default, the archive is
  646. always read to the very end, since there can be multiple
  647. entries with the same name and, by convention, later entries
  648. overwrite earlier entries. This option is provided as a
  649. performance optimization.</p>
  650. <p style="margin-top: 1em"><b>--read-sparse</b></p>
  651. <p style="margin-left:17%;">(c, r, u modes only) Read
  652. sparse file information from disk. This is the reverse of
  653. <b>--no-read-sparse</b> and the default behavior.</p>
  654. <p style="margin-top: 1em"><b>-S</b></p>
  655. <p style="margin-left:17%; margin-top: 1em">(x mode only)
  656. Extract files as sparse files. For every block on disk,
  657. check first if it contains only NULL bytes and seek over it
  658. otherwise. This works similar to the conv=sparse option of
  659. dd.</p>
  660. <p style="margin-top: 1em"><b>-s</b> <i>pattern</i></p>
  661. <p style="margin-left:17%;">Modify file or archive member
  662. names according to <i>pattern</i>. The pattern has the
  663. format <i>/old/new/</i>[ghHprRsS] where <i>old</i> is a
  664. basic regular expression, <i>new</i> is the replacement
  665. string of the matched part, and the optional trailing
  666. letters modify how the replacement is handled. If <i>old</i>
  667. is not matched, the pattern is skipped. Within <i>new</i>, ~
  668. is substituted with the match, \1 to \9 with the content of
  669. the corresponding captured group. The optional trailing g
  670. specifies that matching should continue after the matched
  671. part and stop on the first unmatched pattern. The optional
  672. trailing s specifies that the pattern applies to the value
  673. of symbolic links. The optional trailing p specifies that
  674. after a successful substitution the original path name and
  675. the new path name should be printed to standard error.
  676. Optional trailing H, R, or S characters suppress
  677. substitutions for hardlink targets, regular filenames, or
  678. symlink targets, respectively. Optional trailing h, r, or s
  679. characters enable substitutions for hardlink targets,
  680. regular filenames, or symlink targets, respectively. The
  681. default is <i>hrs</i> which applies substitutions to all
  682. names. In particular, it is never necessary to specify h, r,
  683. or s.</p>
  684. <p style="margin-top: 1em"><b>--safe-writes</b></p>
  685. <p style="margin-left:17%;">(x mode only) Extract files
  686. atomically. By default <b>tar</b> unlinks the original file
  687. with the same name as the extracted file (if it exists), and
  688. then creates it immediately under the same name and writes
  689. to it. For a short period of time, applications trying to
  690. access the file might not find it, or see incomplete
  691. results. If <b>--safe-writes</b> is enabled, <b>tar</b>
  692. first creates a unique temporary file, then writes the new
  693. contents to the temporary file, and finally renames the
  694. temporary file to its final name atomically using rename(2).
  695. This guarantees that an application accessing the file, will
  696. either see the old contents or the new contents at all
  697. times.</p>
  698. <p style="margin-top: 1em"><b>--same-owner</b></p>
  699. <p style="margin-left:17%;">(x mode only) Extract owner and
  700. group IDs. This is the reverse of <b>--no-same-owner</b> and
  701. the default behavior if <b>tar</b> is run as root.</p>
  702. <p style="margin-top: 1em"><b>--strip-components</b>
  703. <i>count</i></p>
  704. <p style="margin-left:17%;">Remove the specified number of
  705. leading path elements. Pathnames with fewer elements will be
  706. silently skipped. Note that the pathname is edited after
  707. checking inclusion/exclusion patterns but before security
  708. checks.</p>
  709. <p style="margin-top: 1em"><b>-T</b> <i>filename</i>,
  710. <b>--files-from</b> <i>filename</i></p>
  711. <p style="margin-left:17%;">In x or t mode, <b>tar</b> will
  712. read the list of names to be extracted from <i>filename</i>.
  713. In c mode, <b>tar</b> will read names to be archived from
  714. <i>filename</i>. The special name &ldquo;-C&rdquo; on a line
  715. by itself will cause the current directory to be changed to
  716. the directory specified on the following line. Names are
  717. terminated by newlines unless <b>--null</b> is specified.
  718. Note that <b>--null</b> also disables the special handling
  719. of lines containing &ldquo;-C&rdquo;. Note: If you are
  720. generating lists of files using find(1), you probably want
  721. to use <b>-n</b> as well.</p>
  722. <p style="margin-top: 1em"><b>--totals</b></p>
  723. <p style="margin-left:17%;">(c, r, u modes only) After
  724. archiving all files, print a summary to stderr.</p>
  725. <p style="margin-top: 1em"><b>-U</b>, <b>--unlink</b>,
  726. <b>--unlink-first</b></p>
  727. <p style="margin-left:17%;">(x mode only) Unlink files
  728. before creating them. This can be a minor performance
  729. optimization if most files already exist, but can make
  730. things slower if most files do not already exist. This flag
  731. also causes <b>tar</b> to remove intervening directory
  732. symlinks instead of reporting an error. See the SECURITY
  733. section below for more details.</p>
  734. <p style="margin-top: 1em"><b>--uid</b> <i>id</i></p>
  735. <p style="margin-left:17%;">Use the provided user id number
  736. and ignore the user name from the archive. On create, if
  737. <b>--uname</b> is not also specified, the user name will be
  738. set to match the user id.</p>
  739. <p style="margin-top: 1em"><b>--uname</b> <i>name</i></p>
  740. <p style="margin-left:17%;">Use the provided user name. On
  741. extract, this overrides the user name in the archive; if the
  742. provided user name does not exist on the system, it will be
  743. ignored and the user id (from the archive or from the
  744. <b>--uid</b> option) will be used instead. On create, this
  745. sets the user name that will be stored in the archive; the
  746. name is not verified against the system user database.</p>
  747. <p style="margin-top: 1em"><b>--use-compress-program</b>
  748. <i>program</i></p>
  749. <p style="margin-left:17%;">Pipe the input (in x or t mode)
  750. or the output (in c mode) through <i>program</i> instead of
  751. using the builtin compression support.</p>
  752. <p style="margin-top: 1em"><b>-v</b>, <b>--verbose</b></p>
  753. <p style="margin-left:17%;">Produce verbose output. In
  754. create and extract modes, <b>tar</b> will list each file
  755. name as it is read from or written to the archive. In list
  756. mode, <b>tar</b> will produce output similar to that of
  757. ls(1). An additional <b>-v</b> option will also provide
  758. ls-like details in create and extract mode.</p>
  759. <p style="margin-top: 1em"><b>--version</b></p>
  760. <p style="margin-left:17%;">Print version of <b>tar</b> and
  761. <b>libarchive</b>, and exit.</p>
  762. <p style="margin-top: 1em"><b>-w</b>,
  763. <b>--confirmation</b>, <b>--interactive</b></p>
  764. <p style="margin-left:17%;">Ask for confirmation for every
  765. action.</p>
  766. <p style="margin-top: 1em"><b>-X</b> <i>filename</i>,
  767. <b>--exclude-from</b> <i>filename</i></p>
  768. <p style="margin-left:17%;">Read a list of exclusion
  769. patterns from the specified file. See <b>--exclude</b> for
  770. more information about the handling of exclusions.</p>
  771. <p style="margin-top: 1em"><b>--xattrs</b></p>
  772. <p style="margin-left:17%;">(c, r, u, x modes only) Archive
  773. or extract extended file attributes. This is the reverse of
  774. <b>--no-xattrs</b> and the default behavior in c, r, and u
  775. modes or if <b>tar</b> is run in x mode as root.</p>
  776. <p style="margin-top: 1em"><b>-y</b></p>
  777. <p style="margin-left:17%; margin-top: 1em">(c mode only)
  778. Compress the resulting archive with bzip2(1). In extract or
  779. list modes, this option is ignored. Note that this
  780. <b>tar</b> implementation recognizes bzip2 compression
  781. automatically when reading archives.</p>
  782. <p style="margin-top: 1em"><b>-Z</b>, <b>--compress</b>,
  783. <b>--uncompress</b></p>
  784. <p style="margin-left:17%;">(c mode only) Compress the
  785. resulting archive with compress(1). In extract or list
  786. modes, this option is ignored. Note that this <b>tar</b>
  787. implementation recognizes compress compression automatically
  788. when reading archives.</p>
  789. <p style="margin-top: 1em"><b>-z</b>, <b>--gunzip</b>,
  790. <b>--gzip</b></p>
  791. <p style="margin-left:17%;">(c mode only) Compress the
  792. resulting archive with gzip(1). In extract or list modes,
  793. this option is ignored. Note that this <b>tar</b>
  794. implementation recognizes gzip compression automatically
  795. when reading archives.</p>
  796. <p style="margin-top: 1em"><b>ENVIRONMENT</b></p>
  797. <p style="margin-left:6%;">The following environment
  798. variables affect the execution of <b>tar</b>:</p>
  799. <p style="margin-top: 1em">TAR_READER_OPTIONS</p>
  800. <p style="margin-left:17%;">The default options for format
  801. readers and compression readers. The <b>--options</b> option
  802. overrides this.</p>
  803. <p style="margin-top: 1em">TAR_WRITER_OPTIONS</p>
  804. <p style="margin-left:17%;">The default options for format
  805. writers and compression writers. The <b>--options</b> option
  806. overrides this.</p>
  807. <p style="margin-top: 1em">LANG</p>
  808. <p style="margin-left:17%; margin-top: 1em">The locale to
  809. use. See environ(7) for more information.</p>
  810. <p style="margin-top: 1em">TAPE</p>
  811. <p style="margin-left:17%; margin-top: 1em">The default
  812. device. The <b>-f</b> option overrides this. Please see the
  813. description of the <b>-f</b> option above for more
  814. details.</p>
  815. <p style="margin-top: 1em">TZ</p>
  816. <p style="margin-left:17%; margin-top: 1em">The timezone to
  817. use when displaying dates. See environ(7) for more
  818. information.</p>
  819. <p style="margin-top: 1em"><b>EXIT STATUS</b></p>
  820. <p style="margin-left:6%;">The <b>tar</b> utility
  821. exits&nbsp;0 on success, and&nbsp;&gt;0 if an error
  822. occurs.</p>
  823. <p style="margin-top: 1em"><b>EXAMPLES</b></p>
  824. <p style="margin-left:6%;">The following creates a new
  825. archive called <i>file.tar.gz</i> that contains two files
  826. <i>source.c</i> and <i>source.h</i>:</p>
  827. <p style="margin-left:14%;"><b>tar -czf</b> <i>file.tar.gz
  828. source.c source.h</i></p>
  829. <p style="margin-left:6%; margin-top: 1em">To view a
  830. detailed table of contents for this archive:</p>
  831. <p style="margin-left:14%;"><b>tar -tvf</b>
  832. <i>file.tar.gz</i></p>
  833. <p style="margin-left:6%; margin-top: 1em">To extract all
  834. entries from the archive on the default tape drive:</p>
  835. <p style="margin-left:14%;"><b>tar -x</b></p>
  836. <p style="margin-left:6%; margin-top: 1em">To examine the
  837. contents of an ISO 9660 cdrom image:</p>
  838. <p style="margin-left:14%;"><b>tar -tf</b>
  839. <i>image.iso</i></p>
  840. <p style="margin-left:6%; margin-top: 1em">To move file
  841. hierarchies, invoke <b>tar</b> as</p>
  842. <p style="margin-left:14%;"><b>tar -cf</b> <i>-</i>
  843. <b>-C</b> <i>srcdir .</i> | <b>tar -xpf</b> <i>-</i>
  844. <b>-C</b> <i>destdir</i></p>
  845. <p style="margin-left:6%;">or more traditionally</p>
  846. <p style="margin-left:14%;">cd srcdir ; <b>tar -cf</b> <i>-
  847. .</i> | (<i>cd destdir ;</i> <b>tar -xpf</b> <i>-</i>)</p>
  848. <p style="margin-left:6%; margin-top: 1em">In create mode,
  849. the list of files and directories to be archived can also
  850. include directory change instructions of the form
  851. <b>-C</b><i>foo/baz</i> and archive inclusions of the form
  852. <b>@</b><i>archive-file</i>. For example, the command
  853. line</p>
  854. <p style="margin-left:14%;"><b>tar -c -f</b> <i>new.tar
  855. foo1</i> <b>@</b><i>old.tgz</i> <b>-C</b><i>/tmp
  856. foo2</i></p>
  857. <p style="margin-left:6%;">will create a new archive
  858. <i>new.tar</i>. <b>tar</b> will read the file <i>foo1</i>
  859. from the current directory and add it to the output archive.
  860. It will then read each entry from <i>old.tgz</i> and add
  861. those entries to the output archive. Finally, it will switch
  862. to the <i>/tmp</i> directory and add <i>foo2</i> to the
  863. output archive.</p>
  864. <p style="margin-left:6%; margin-top: 1em">An input file in
  865. mtree(5) format can be used to create an output archive with
  866. arbitrary ownership, permissions, or names that differ from
  867. existing data on disk:</p>
  868. <p style="margin-left:14%; margin-top: 1em">$ cat
  869. input.mtree <br>
  870. #mtree <br>
  871. usr/bin uid=0 gid=0 mode=0755 type=dir <br>
  872. usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls <br>
  873. $ tar -cvf output.tar @input.mtree</p>
  874. <p style="margin-left:6%; margin-top: 1em">The
  875. <b>--newer</b> and <b>--newer-mtime</b> switches accept a
  876. variety of common date and time specifications, including
  877. &ldquo;12 Mar 2005 7:14:29pm&rdquo;, &ldquo;2005-03-12
  878. 19:14&rdquo;, &ldquo;5 minutes ago&rdquo;, and &ldquo;19:14
  879. PST May 1&rdquo;.</p>
  880. <p style="margin-left:6%; margin-top: 1em">The
  881. <b>--options</b> argument can be used to control various
  882. details of archive generation or reading. For example, you
  883. can generate mtree output which only contains <b>type</b>,
  884. <b>time</b>, and <b>uid</b> keywords:</p>
  885. <p style="margin-left:14%;"><b>tar -cf</b> <i>file.tar</i>
  886. <b>--format=mtree
  887. --options=&rsquo;!all,type,time,uid&rsquo;</b>
  888. <i>dir</i></p>
  889. <p style="margin-left:6%;">or you can set the compression
  890. level used by gzip or xz compression:</p>
  891. <p style="margin-left:14%;"><b>tar -czf</b> <i>file.tar</i>
  892. <b>--options=&rsquo;compression-level=9&rsquo;</b>.</p>
  893. <p style="margin-left:6%;">For more details, see the
  894. explanation of the <b>archive_read_set_options</b>() and
  895. <b>archive_write_set_options</b>() API calls that are
  896. described in archive_read(3) and archive_write(3).</p>
  897. <p style="margin-top: 1em"><b>COMPATIBILITY</b></p>
  898. <p style="margin-left:6%;">The bundled-arguments format is
  899. supported for compatibility with historic implementations.
  900. It consists of an initial word (with no leading - character)
  901. in which each character indicates an option. Arguments
  902. follow as separate words. The order of the arguments must
  903. match the order of the corresponding characters in the
  904. bundled command word. For example,</p>
  905. <p style="margin-left:14%;"><b>tar tbf 32</b>
  906. <i>file.tar</i></p>
  907. <p style="margin-left:6%;">specifies three flags <b>t</b>,
  908. <b>b</b>, and <b>f</b>. The <b>b</b> and <b>f</b> flags both
  909. require arguments, so there must be two additional items on
  910. the command line. The <i>32</i> is the argument to the
  911. <b>b</b> flag, and <i>file.tar</i> is the argument to the
  912. <b>f</b> flag.</p>
  913. <p style="margin-left:6%; margin-top: 1em">The mode options
  914. c, r, t, u, and x and the options b, f, l, m, o, v, and w
  915. comply with SUSv2.</p>
  916. <p style="margin-left:6%; margin-top: 1em">For maximum
  917. portability, scripts that invoke <b>tar</b> should use the
  918. bundled-argument format above, should limit themselves to
  919. the <b>c</b>, <b>t</b>, and <b>x</b> modes, and the
  920. <b>b</b>, <b>f</b>, <b>m</b>, <b>v</b>, and <b>w</b>
  921. options.</p>
  922. <p style="margin-left:6%; margin-top: 1em">Additional long
  923. options are provided to improve compatibility with other tar
  924. implementations.</p>
  925. <p style="margin-top: 1em"><b>SECURITY</b></p>
  926. <p style="margin-left:6%;">Certain security issues are
  927. common to many archiving programs, including <b>tar</b>. In
  928. particular, carefully-crafted archives can request that
  929. <b>tar</b> extract files to locations outside of the target
  930. directory. This can potentially be used to cause unwitting
  931. users to overwrite files they did not intend to overwrite.
  932. If the archive is being extracted by the superuser, any file
  933. on the system can potentially be overwritten. There are
  934. three ways this can happen. Although <b>tar</b> has
  935. mechanisms to protect against each one, savvy users should
  936. be aware of the implications:</p>
  937. <p style="margin-top: 1em"><b>&bull;</b></p>
  938. <p style="margin-left:17%;">Archive entries can have
  939. absolute pathnames. By default, <b>tar</b> removes the
  940. leading <i>/</i> character from filenames before restoring
  941. them to guard against this problem.</p>
  942. <p style="margin-top: 1em"><b>&bull;</b></p>
  943. <p style="margin-left:17%;">Archive entries can have
  944. pathnames that include <i>..</i> components. By default,
  945. <b>tar</b> will not extract files containing <i>..</i>
  946. components in their pathname.</p>
  947. <p style="margin-top: 1em"><b>&bull;</b></p>
  948. <p style="margin-left:17%;">Archive entries can exploit
  949. symbolic links to restore files to other directories. An
  950. archive can restore a symbolic link to another directory,
  951. then use that link to restore a file into that directory. To
  952. guard against this, <b>tar</b> checks each extracted path
  953. for symlinks. If the final path element is a symlink, it
  954. will be removed and replaced with the archive entry. If
  955. <b>-U</b> is specified, any intermediate symlink will also
  956. be unconditionally removed. If neither <b>-U</b> nor
  957. <b>-P</b> is specified, <b>tar</b> will refuse to extract
  958. the entry.</p>
  959. <p style="margin-left:6%;">To protect yourself, you should
  960. be wary of any archives that come from untrusted sources.
  961. You should examine the contents of an archive with</p>
  962. <p style="margin-left:14%;"><b>tar -tf</b>
  963. <i>filename</i></p>
  964. <p style="margin-left:6%;">before extraction. You should
  965. use the <b>-k</b> option to ensure that <b>tar</b> will not
  966. overwrite any existing files or the <b>-U</b> option to
  967. remove any pre-existing files. You should generally not
  968. extract archives while running with super-user privileges.
  969. Note that the <b>-P</b> option to <b>tar</b> disables the
  970. security checks above and allows you to extract an archive
  971. while preserving any absolute pathnames, <i>..</i>
  972. components, or symlinks to other directories.</p>
  973. <p style="margin-top: 1em"><b>SEE ALSO</b></p>
  974. <p style="margin-left:6%;">bzip2(1), compress(1), cpio(1),
  975. gzip(1), mt(1), pax(1), shar(1), xz(1), libarchive(3),
  976. libarchive-formats(5), tar(5)</p>
  977. <p style="margin-top: 1em"><b>STANDARDS</b></p>
  978. <p style="margin-left:6%;">There is no current POSIX
  979. standard for the tar command; it appeared in ISO/IEC
  980. 9945-1:1996 (&ldquo;POSIX.1&rdquo;) but was dropped from
  981. IEEE Std 1003.1-2001 (&ldquo;POSIX.1&rdquo;). The options
  982. supported by this implementation were developed by surveying
  983. a number of existing tar implementations as well as the old
  984. POSIX specification for tar and the current POSIX
  985. specification for pax.</p>
  986. <p style="margin-left:6%; margin-top: 1em">The ustar and
  987. pax interchange file formats are defined by IEEE Std
  988. 1003.1-2001 (&ldquo;POSIX.1&rdquo;) for the pax command.</p>
  989. <p style="margin-top: 1em"><b>HISTORY</b></p>
  990. <p style="margin-left:6%;">A <b>tar</b> command appeared in
  991. Seventh Edition Unix, which was released in January, 1979.
  992. There have been numerous other implementations, many of
  993. which extended the file format. John Gilmore&rsquo;s
  994. <b>pdtar</b> public-domain implementation (circa November,
  995. 1987) was quite influential, and formed the basis of GNU
  996. tar. GNU tar was included as the standard system tar in
  997. FreeBSD beginning with FreeBSD&nbsp;1.0.</p>
  998. <p style="margin-left:6%; margin-top: 1em">This is a
  999. complete re-implementation based on the libarchive(3)
  1000. library. It was first released with FreeBSD&nbsp;5.4 in May,
  1001. 2005.</p>
  1002. <p style="margin-top: 1em"><b>BUGS</b></p>
  1003. <p style="margin-left:6%;">This program follows ISO/IEC
  1004. 9945-1:1996 (&ldquo;POSIX.1&rdquo;) for the definition of
  1005. the <b>-l</b> option. Note that GNU tar prior to version
  1006. 1.15 treated <b>-l</b> as a synonym for the
  1007. <b>--one-file-system</b> option.</p>
  1008. <p style="margin-left:6%; margin-top: 1em">The <b>-C</b>
  1009. <i>dir</i> option may differ from historic
  1010. implementations.</p>
  1011. <p style="margin-left:6%; margin-top: 1em">All archive
  1012. output is written in correctly-sized blocks, even if the
  1013. output is being compressed. Whether or not the last output
  1014. block is padded to a full block size varies depending on the
  1015. format and the output device. For tar and cpio formats, the
  1016. last block of output is padded to a full block size if the
  1017. output is being written to standard output or to a character
  1018. or block device such as a tape drive. If the output is being
  1019. written to a regular file, the last block will not be
  1020. padded. Many compressors, including gzip(1) and bzip2(1),
  1021. complain about the null padding when decompressing an
  1022. archive created by <b>tar</b>, although they still extract
  1023. it correctly.</p>
  1024. <p style="margin-left:6%; margin-top: 1em">The compression
  1025. and decompression is implemented internally, so there may be
  1026. insignificant differences between the compressed output
  1027. generated by</p>
  1028. <p style="margin-left:14%;"><b>tar -czf</b> <i>-
  1029. file</i></p>
  1030. <p style="margin-left:6%;">and that generated by</p>
  1031. <p style="margin-left:14%;"><b>tar -cf</b> <i>- file</i> |
  1032. <b>gzip</b></p>
  1033. <p style="margin-left:6%; margin-top: 1em">The default
  1034. should be to read and write archives to the standard I/O
  1035. paths, but tradition (and POSIX) dictates otherwise.</p>
  1036. <p style="margin-left:6%; margin-top: 1em">The <b>r</b> and
  1037. <b>u</b> modes require that the archive be uncompressed and
  1038. located in a regular file on disk. Other archives can be
  1039. modified using <b>c</b> mode with the <i>@archive-file</i>
  1040. extension.</p>
  1041. <p style="margin-left:6%; margin-top: 1em">To archive a
  1042. file called <i>@foo</i> or <i>-foo</i> you must specify it
  1043. as <i>./@foo</i> or <i>./-foo</i>, respectively.</p>
  1044. <p style="margin-left:6%; margin-top: 1em">In create mode,
  1045. a leading <i>./</i> is always removed. A leading <i>/</i> is
  1046. stripped unless the <b>-P</b> option is specified.</p>
  1047. <p style="margin-left:6%; margin-top: 1em">There needs to
  1048. be better support for file selection on both create and
  1049. extract.</p>
  1050. <p style="margin-left:6%; margin-top: 1em">There is not yet
  1051. any support for multi-volume archives.</p>
  1052. <p style="margin-left:6%; margin-top: 1em">Converting
  1053. between dissimilar archive formats (such as tar and cpio)
  1054. using the <b>@</b><i>-</i> convention can cause hard link
  1055. information to be lost. (This is a consequence of the
  1056. incompatible ways that different archive formats store
  1057. hardlink information.)</p>
  1058. <p style="margin-left:6%; margin-top: 1em">BSD
  1059. December&nbsp;1, 2022 BSD</p>
  1060. <hr>
  1061. </body>
  1062. </html>