bsdcpio.1.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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>CPIO(1) BSD General Commands Manual CPIO(1)</p>
  21. <p style="margin-top: 1em"><b>NAME</b></p>
  22. <p style="margin-left:6%;"><b>cpio</b> &mdash; copy files
  23. to and from archives</p>
  24. <p style="margin-top: 1em"><b>SYNOPSIS</b></p>
  25. <p style="margin-left:13%;"><b>cpio -i</b> [<i>options</i>]
  26. [<i>pattern&nbsp;...</i>] [<i>&lt;&nbsp;archive</i>] <b><br>
  27. cpio -o</b> [<i>options</i>] <i>&lt; name-list</i>
  28. [<i>&gt;&nbsp;archive</i>] <b><br>
  29. cpio -p</b> [<i>options</i>] <i>dest-dir &lt;
  30. name-list</i></p>
  31. <p style="margin-top: 1em"><b>DESCRIPTION</b></p>
  32. <p style="margin-left:6%;"><b>cpio</b> copies files between
  33. archives and directories. This implementation can extract
  34. from tar, pax, cpio, zip, jar, ar, and ISO 9660 cdrom images
  35. and can create tar, pax, cpio, ar, and shar archives.</p>
  36. <p style="margin-left:6%; margin-top: 1em">The first option
  37. to <b>cpio</b> is a mode indicator from the following
  38. list:</p>
  39. <p><b>-i</b></p>
  40. <p style="margin-left:17%; margin-top: 1em">Input. Read an
  41. archive from standard input (unless overridden) and extract
  42. the contents to disk or (if the <b>-t</b> option is
  43. specified) list the contents to standard output. If one or
  44. more file patterns are specified, only files matching one of
  45. the patterns will be extracted.</p>
  46. <p><b>-o</b></p>
  47. <p style="margin-left:17%; margin-top: 1em">Output. Read a
  48. list of filenames from standard input and produce a new
  49. archive on standard output (unless overridden) containing
  50. the specified items.</p>
  51. <p><b>-p</b></p>
  52. <p style="margin-left:17%; margin-top: 1em">Pass-through.
  53. Read a list of filenames from standard input and copy the
  54. files to the specified directory.</p>
  55. <p style="margin-top: 1em"><b>OPTIONS</b></p>
  56. <p style="margin-left:6%;">Unless specifically stated
  57. otherwise, options are applicable in all operating
  58. modes.</p>
  59. <p style="margin-top: 1em"><b>-0</b>, <b>--null</b></p>
  60. <p style="margin-left:17%;">Read filenames separated by NUL
  61. characters instead of newlines. This is necessary if any of
  62. the filenames being read might contain newlines.</p>
  63. <p style="margin-top: 1em"><b>-6</b>, <b>--pwb</b></p>
  64. <p style="margin-left:17%;">When reading a binary format
  65. archive, assume it&rsquo;s the earlier one, from the PWB
  66. variant of 6th Edition UNIX. When writing a cpio archive,
  67. use the PWB format.</p>
  68. <p style="margin-top: 1em"><b>-7</b>, <b>--binary</b></p>
  69. <p style="margin-left:17%;">(o mode only) When writing a
  70. cpio archive, use the (newer, non-PWB) binary format.</p>
  71. <p style="margin-top: 1em"><b>-A</b></p>
  72. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  73. Append to the specified archive. (Not yet implemented.)</p>
  74. <p style="margin-top: 1em"><b>-a</b></p>
  75. <p style="margin-left:17%; margin-top: 1em">(o and p modes)
  76. Reset access times on files after they are read.</p>
  77. <p style="margin-top: 1em"><b>-B</b></p>
  78. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  79. Block output to records of 5120 bytes.</p>
  80. <p style="margin-top: 1em"><b>-C</b> <i>size</i></p>
  81. <p style="margin-left:17%;">(o mode only) Block output to
  82. records of <i>size</i> bytes.</p>
  83. <p style="margin-top: 1em"><b>-c</b></p>
  84. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  85. Use the old POSIX portable character format. Equivalent to
  86. <b>--format</b> <i>odc</i>.</p>
  87. <p style="margin-top: 1em"><b>-d</b>,
  88. <b>--make-directories</b></p>
  89. <p style="margin-left:17%;">(i and p modes) Create
  90. directories as necessary.</p>
  91. <p style="margin-top: 1em"><b>-E</b> <i>file</i></p>
  92. <p style="margin-left:17%;">(i mode only) Read list of file
  93. name patterns from <i>file</i> to list and extract.</p>
  94. <p style="margin-top: 1em"><b>-F</b> <i>file</i>,
  95. <b>--file</b> <i>file</i></p>
  96. <p style="margin-left:17%;">Read archive from or write
  97. archive to <i>file</i>.</p>
  98. <p style="margin-top: 1em"><b>-f</b> <i>pattern</i></p>
  99. <p style="margin-left:17%;">(i mode only) Ignore files that
  100. match <i>pattern</i>.</p>
  101. <p style="margin-top: 1em"><b>-H</b> <i>format</i>,
  102. <b>--format</b> <i>format</i></p>
  103. <p style="margin-left:17%;">(o mode only) Produce the
  104. output archive in the specified format. Supported formats
  105. include:</p>
  106. <p style="margin-top: 1em"><i>cpio</i></p>
  107. <p style="margin-left:28%; margin-top: 1em">Synonym for
  108. <i>odc</i>.</p>
  109. <p><i>newc</i></p>
  110. <p style="margin-left:28%; margin-top: 1em">The SVR4
  111. portable cpio format.</p>
  112. <p><i>odc</i></p>
  113. <p style="margin-left:28%; margin-top: 1em">The old POSIX.1
  114. portable octet-oriented cpio format.</p>
  115. <p><i>pax</i></p>
  116. <p style="margin-left:28%; margin-top: 1em">The POSIX.1 pax
  117. format, an extension of the ustar format.</p>
  118. <p><i>ustar</i></p>
  119. <p style="margin-left:28%; margin-top: 1em">The POSIX.1 tar
  120. format.</p>
  121. <p style="margin-left:17%; margin-top: 1em">The default
  122. format is <i>odc</i>. See libarchive-formats(5) for more
  123. complete information about the formats currently supported
  124. by the underlying libarchive(3) library.</p>
  125. <p style="margin-top: 1em"><b>-h</b>, <b>--help</b></p>
  126. <p style="margin-left:17%;">Print usage information.</p>
  127. <p style="margin-top: 1em"><b>-I</b> <i>file</i></p>
  128. <p style="margin-left:17%;">Read archive from
  129. <i>file</i>.</p>
  130. <p style="margin-top: 1em"><b>-i</b>, <b>--extract</b></p>
  131. <p style="margin-left:17%;">Input mode. See above for
  132. description.</p>
  133. <p style="margin-top: 1em"><b>--insecure</b></p>
  134. <p style="margin-left:17%;">(i and p mode only) Disable
  135. security checks during extraction or copying. This allows
  136. extraction via symbolic links, absolute paths, and path
  137. names containing &rsquo;..&rsquo; in the name.</p>
  138. <p style="margin-top: 1em"><b>-J</b>, <b>--xz</b></p>
  139. <p style="margin-left:17%;">(o mode only) Compress the file
  140. with xz-compatible compression before writing it. In input
  141. mode, this option is ignored; xz compression is recognized
  142. automatically on input.</p>
  143. <p style="margin-top: 1em"><b>-j</b></p>
  144. <p style="margin-left:17%; margin-top: 1em">Synonym for
  145. <b>-y</b>.</p>
  146. <p style="margin-top: 1em"><b>-L</b></p>
  147. <p style="margin-left:17%; margin-top: 1em">(o and p modes)
  148. All symbolic links will be followed. Normally, symbolic
  149. links are archived and copied as symbolic links. With this
  150. option, the target of the link will be archived or copied
  151. instead.</p>
  152. <p style="margin-top: 1em"><b>-l</b>, <b>--link</b></p>
  153. <p style="margin-left:17%;">(p mode only) Create links from
  154. the target directory to the original files, instead of
  155. copying.</p>
  156. <p style="margin-top: 1em"><b>--lrzip</b></p>
  157. <p style="margin-left:17%;">(o mode only) Compress the
  158. resulting archive with lrzip(1). In input mode, this option
  159. is ignored.</p>
  160. <p style="margin-top: 1em"><b>--lz4</b></p>
  161. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  162. Compress the archive with lz4-compatible compression before
  163. writing it. In input mode, this option is ignored; lz4
  164. compression is recognized automatically on input.</p>
  165. <p style="margin-top: 1em"><b>--zstd</b></p>
  166. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  167. Compress the archive with zstd-compatible compression before
  168. writing it. In input mode, this option is ignored; zstd
  169. compression is recognized automatically on input.</p>
  170. <p style="margin-top: 1em"><b>--lzma</b></p>
  171. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  172. Compress the file with lzma-compatible compression before
  173. writing it. In input mode, this option is ignored; lzma
  174. compression is recognized automatically on input.</p>
  175. <p style="margin-top: 1em"><b>--lzop</b></p>
  176. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  177. Compress the resulting archive with lzop(1). In input mode,
  178. this option is ignored.</p>
  179. <p style="margin-top: 1em"><b>--passphrase</b>
  180. <i>passphrase</i></p>
  181. <p style="margin-left:17%;">The <i>passphrase</i> is used
  182. to extract or create an encrypted archive. Currently, zip is
  183. only a format that <b>cpio</b> can handle encrypted
  184. archives. You shouldn&rsquo;t use this option unless you
  185. realize how insecure use of this option is.</p>
  186. <p style="margin-top: 1em"><b>-m</b>,
  187. <b>--preserve-modification-time</b></p>
  188. <p style="margin-left:17%;">(i and p modes) Set file
  189. modification time on created files to match those in the
  190. source.</p>
  191. <p style="margin-top: 1em"><b>-n</b>,
  192. <b>--numeric-uid-gid</b></p>
  193. <p style="margin-left:17%;">(i mode, only with <b>-t</b>)
  194. Display numeric uid and gid. By default, <b>cpio</b>
  195. displays the user and group names when they are provided in
  196. the archive, or looks up the user and group names in the
  197. system password database.</p>
  198. <p style="margin-top: 1em"><b>--no-preserve-owner</b></p>
  199. <p style="margin-left:17%;">(i mode only) Do not attempt to
  200. restore file ownership. This is the default when run by
  201. non-root users.</p>
  202. <p style="margin-top: 1em"><b>-O</b> <i>file</i></p>
  203. <p style="margin-left:17%;">Write archive to
  204. <i>file</i>.</p>
  205. <p style="margin-top: 1em"><b>-o</b>, <b>--create</b></p>
  206. <p style="margin-left:17%;">Output mode. See above for
  207. description.</p>
  208. <p style="margin-top: 1em"><b>-p</b>,
  209. <b>--pass-through</b></p>
  210. <p style="margin-left:17%;">Pass-through mode. See above
  211. for description.</p>
  212. <p style="margin-top: 1em"><b>--preserve-owner</b></p>
  213. <p style="margin-left:17%;">(i mode only) Restore file
  214. ownership. This is the default when run by the root
  215. user.</p>
  216. <p style="margin-top: 1em"><b>--quiet</b></p>
  217. <p style="margin-left:17%;">Suppress unnecessary
  218. messages.</p>
  219. <p style="margin-top: 1em"><b>-R</b> [ <br>
  220. user][ <br>
  221. :][ <br>
  222. group], <b>--owner</b> [ <br>
  223. user][ <br>
  224. :][ <br>
  225. group]</p>
  226. <p style="margin-left:17%;">Set the owner and/or group on
  227. files in the output. If group is specified with no user (for
  228. example, <b>-R</b> <i>:wheel</i>) then the group will be set
  229. but not the user. If the user is specified with a trailing
  230. colon and no group (for example, <b>-R</b> <i>root:</i>)
  231. then the group will be set to the user&rsquo;s default
  232. group. If the user is specified with no trailing colon, then
  233. the user will be set but not the group. In <b>-i</b> and
  234. <b>-p</b> modes, this option can only be used by the
  235. super-user. (For compatibility, a period can be used in
  236. place of the colon.)</p>
  237. <p style="margin-top: 1em"><b>-r</b></p>
  238. <p style="margin-left:17%; margin-top: 1em">(All modes.)
  239. Rename files interactively. For each file, a prompt is
  240. written to <i>/dev/tty</i> containing the name of the file
  241. and a line is read from <i>/dev/tty</i>. If the line read is
  242. blank, the file is skipped. If the line contains a single
  243. period, the file is processed normally. Otherwise, the line
  244. is taken to be the new name of the file.</p>
  245. <p style="margin-top: 1em"><b>-t</b>, <b>--list</b></p>
  246. <p style="margin-left:17%;">(i mode only) List the contents
  247. of the archive to stdout; do not restore the contents to
  248. disk.</p>
  249. <p style="margin-top: 1em"><b>-u</b>,
  250. <b>--unconditional</b></p>
  251. <p style="margin-left:17%;">(i and p modes) Unconditionally
  252. overwrite existing files. Ordinarily, an older file will not
  253. overwrite a newer file on disk.</p>
  254. <p style="margin-top: 1em"><b>-V</b>, <b>--dot</b></p>
  255. <p style="margin-left:17%;">Print a dot to stderr for each
  256. file as it is processed. Superseded by <b>-v</b>.</p>
  257. <p style="margin-top: 1em"><b>-v</b>, <b>--verbose</b></p>
  258. <p style="margin-left:17%;">Print the name of each file to
  259. stderr as it is processed. With <b>-t</b>, provide a
  260. detailed listing of each file.</p>
  261. <p style="margin-top: 1em"><b>--version</b></p>
  262. <p style="margin-left:17%;">Print the program version
  263. information and exit.</p>
  264. <p style="margin-top: 1em"><b>-y</b></p>
  265. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  266. Compress the archive with bzip2-compatible compression
  267. before writing it. In input mode, this option is ignored;
  268. bzip2 compression is recognized automatically on input.</p>
  269. <p style="margin-top: 1em"><b>-Z</b></p>
  270. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  271. Compress the archive with compress-compatible compression
  272. before writing it. In input mode, this option is ignored;
  273. compression is recognized automatically on input.</p>
  274. <p style="margin-top: 1em"><b>-z</b></p>
  275. <p style="margin-left:17%; margin-top: 1em">(o mode only)
  276. Compress the archive with gzip-compatible compression before
  277. writing it. In input mode, this option is ignored; gzip
  278. compression is recognized automatically on input.</p>
  279. <p style="margin-top: 1em"><b>EXIT STATUS</b></p>
  280. <p style="margin-left:6%;">The <b>cpio</b> utility
  281. exits&nbsp;0 on success, and&nbsp;&gt;0 if an error
  282. occurs.</p>
  283. <p style="margin-top: 1em"><b>ENVIRONMENT</b></p>
  284. <p style="margin-left:6%;">The following environment
  285. variables affect the execution of <b>cpio</b>:</p>
  286. <p style="margin-top: 1em">LANG</p>
  287. <p style="margin-left:21%; margin-top: 1em">The locale to
  288. use. See environ(7) for more information.</p>
  289. <p style="margin-top: 1em">TZ</p>
  290. <p style="margin-left:21%; margin-top: 1em">The timezone to
  291. use when displaying dates. See environ(7) for more
  292. information.</p>
  293. <p style="margin-top: 1em"><b>EXAMPLES</b></p>
  294. <p style="margin-left:6%;">The <b>cpio</b> command is
  295. traditionally used to copy file hierarchies in conjunction
  296. with the find(1) command. The first example here simply
  297. copies all files from <i>src</i> to <i>dest</i>:</p>
  298. <p style="margin-left:14%;"><b>find</b> <i>src</i> |
  299. <b>cpio -pmud</b> <i>dest</i></p>
  300. <p style="margin-left:6%; margin-top: 1em">By carefully
  301. selecting options to the find(1) command and combining it
  302. with other standard utilities, it is possible to exercise
  303. very fine control over which files are copied. This next
  304. example copies files from <i>src</i> to <i>dest</i> that are
  305. more than 2 days old and whose names match a particular
  306. pattern:</p>
  307. <p style="margin-left:14%;"><b>find</b> <i>src</i>
  308. <b>-mtime</b> <i>+2</i> | <b>grep foo[bar]</b> | <b>cpio
  309. -pdmu</b> <i>dest</i></p>
  310. <p style="margin-left:6%; margin-top: 1em">This example
  311. copies files from <i>src</i> to <i>dest</i> that are more
  312. than 2 days old and which contain the word &ldquo;</p>
  313. <p>foobar &rdquo;:</p>
  314. <p style="margin-left:14%;"><b>find</b> <i>src</i>
  315. <b>-mtime</b> <i>+2</i> | <b>xargs grep -l foobar</b> |
  316. <b>cpio -pdmu</b> <i>dest</i></p>
  317. <p style="margin-top: 1em"><b>COMPATIBILITY</b></p>
  318. <p style="margin-left:6%;">The mode options i, o, and p and
  319. the options a, B, c, d, f, l, m, r, t, u, and v comply with
  320. SUSv2.</p>
  321. <p style="margin-left:6%; margin-top: 1em">The old POSIX.1
  322. standard specified that only <b>-i</b>, <b>-o</b>, and
  323. <b>-p</b> were interpreted as command-line options. Each
  324. took a single argument of a list of modifier characters. For
  325. example, the standard syntax allows <b>-imu</b> but does not
  326. support <b>-miu</b> or <b>-i -m -u</b>, since <i>m</i> and
  327. <i>u</i> are only modifiers to <b>-i</b>, they are not
  328. command-line options in their own right. The syntax
  329. supported by this implementation is backwards-compatible
  330. with the standard. For best compatibility, scripts should
  331. limit themselves to the standard syntax.</p>
  332. <p style="margin-top: 1em"><b>SEE ALSO</b></p>
  333. <p style="margin-left:6%;">bzip2(1), gzip(1), mt(1),
  334. pax(1), tar(1), libarchive(3), cpio(5),
  335. libarchive-formats(5), tar(5)</p>
  336. <p style="margin-top: 1em"><b>STANDARDS</b></p>
  337. <p style="margin-left:6%;">There is no current POSIX
  338. standard for the cpio command; it appeared in ISO/IEC
  339. 9945-1:1996 (&ldquo;POSIX.1&rdquo;) but was dropped from
  340. IEEE Std 1003.1-2001 (&ldquo;POSIX.1&rdquo;).</p>
  341. <p style="margin-left:6%; margin-top: 1em">The cpio, ustar,
  342. and pax interchange file formats are defined by IEEE Std
  343. 1003.1-2001 (&ldquo;POSIX.1&rdquo;) for the pax command.</p>
  344. <p style="margin-top: 1em"><b>HISTORY</b></p>
  345. <p style="margin-left:6%;">The original <b>cpio</b> and
  346. <b>find</b> utilities were written by Dick Haight while
  347. working in AT&amp;T&rsquo;s Unix Support Group. They first
  348. appeared in 1977 in PWB/UNIX 1.0, the
  349. &ldquo;Programmer&rsquo;s Work Bench&rdquo; system developed
  350. for use within AT&amp;T. They were first released outside of
  351. AT&amp;T as part of System III Unix in 1981. As a result,
  352. <b>cpio</b> actually predates <b>tar</b>, even though it was
  353. not well-known outside of AT&amp;T until some time
  354. later.</p>
  355. <p style="margin-left:6%; margin-top: 1em">This is a
  356. complete re-implementation based on the libarchive(3)
  357. library.</p>
  358. <p style="margin-top: 1em"><b>BUGS</b></p>
  359. <p style="margin-left:6%;">The cpio archive format has
  360. several basic limitations: It does not store user and group
  361. names, only numbers. As a result, it cannot be reliably used
  362. to transfer files between systems with dissimilar user and
  363. group numbering. Older cpio formats limit the user and group
  364. numbers to 16 or 18 bits, which is insufficient for modern
  365. systems. The cpio archive formats cannot support files over
  366. 4 gigabytes, except for the &ldquo;odc&rdquo; variant, which
  367. can support files up to 8 gigabytes.</p>
  368. <p style="margin-left:6%; margin-top: 1em">BSD
  369. September&nbsp;16, 2014 BSD</p>
  370. <hr>
  371. </body>
  372. </html>