cpio.1 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943
  1. '\" t
  2. .\" Copyright (c) 2003 Gunnar Ritter
  3. .\"
  4. .\" This software is provided 'as-is', without any express or implied
  5. .\" warranty. In no event will the authors be held liable for any damages
  6. .\" arising from the use of this software.
  7. .\"
  8. .\" Permission is granted to anyone to use this software for any purpose,
  9. .\" including commercial applications, and to alter it and redistribute
  10. .\" it freely, subject to the following restrictions:
  11. .\"
  12. .\" 1. The origin of this software must not be misrepresented; you must not
  13. .\" claim that you wrote the original software. If you use this software
  14. .\" in a product, an acknowledgment in the product documentation would be
  15. .\" appreciated but is not required.
  16. .\"
  17. .\" 2. Altered source versions must be plainly marked as such, and must not be
  18. .\" misrepresented as being the original software.
  19. .\"
  20. .\" 3. This notice may not be removed or altered from any source distribution.
  21. .\" Sccsid @(#)cpio.1 1.92 (gritter) 3/26/07
  22. .TH CPIO 1 "3/26/07" "Heirloom Toolchest" "User Commands"
  23. .SH NAME
  24. cpio \- copy file archives in and out
  25. .SH SYNOPSIS
  26. .PD 0
  27. .HP
  28. .nh
  29. .ad l
  30. \fBcpio\fR \fB\-i\fR[\fBbcdfkmrstuvBSV6\fR] [\fB\-C\fI\ size\fR]
  31. [\fB\-E\fI\ file\fR] [\fB\-H\fI\ hdr\fR] [[\fB\-I\fI\ file\fR]
  32. [\fB\-M\fI\ msg\fR]] [\fB\-R\fI\ id\fR] [\fIpatterns\fR]
  33. .HP
  34. .ad l
  35. \fBcpio\fR \fB\-o\fR[\fBacvABLPV\fR] [\fB\-C\fI\ size\fR]
  36. [\fB\-H\fI\ hdr\fR] [[\fB\-M\fI\ msg\fR] [\fB\-O\fI\ file\fR]]
  37. .HP
  38. .ad l
  39. \fBcpio\fR \fB\-p\fR[\fBadlmPuvLV\fR] [\fB\-R\fI\ id\fR] \fIdirectory\fR
  40. .br
  41. .PD
  42. .ad b
  43. .hy 1
  44. .SH DESCRIPTION
  45. .I Cpio
  46. creates and extracts file archives and copies files.
  47. .PP
  48. With the
  49. .B \-i
  50. option,
  51. .I cpio
  52. works in
  53. .RI ` copy-in '
  54. mode and extracts files from a file archive.
  55. By default,
  56. the archive is read from standard input.
  57. Optional arguments are interpreted as
  58. .I patterns
  59. and restrict the set of extracted files
  60. to those matching any of the
  61. .IR patterns .
  62. A
  63. .RB ` !\& '
  64. at the beginning of the
  65. .I pattern
  66. selects all files that do not match this
  67. .IR pattern .
  68. The syntax is otherwise identical to that described in
  69. .IR glob (7),
  70. except that the slash character
  71. .RB ` / '
  72. is matched by
  73. meta-character constructs with
  74. .RB ` * ',
  75. .RB ` ? '
  76. and
  77. .RB ` [ '.
  78. Care must be taken to quote meta-characters appropriately from the shell.
  79. File permissions are set to those in the archive;
  80. if the caller is the super-user,
  81. ownerships are restored as well.
  82. .I Cpio
  83. will not create directories,
  84. preserve modification times
  85. or overwrite more recently modified target files
  86. unless the appropriate
  87. .IR \-d ,
  88. .I \-m
  89. or
  90. .I \-u
  91. options are specified.
  92. Archives compressed with
  93. .IR bzip2 (1),
  94. .IR compress (1),
  95. .IR gzip (1),
  96. or
  97. .IR rpm (1)
  98. are transparently de\%compressed on input.
  99. .PP
  100. With
  101. .BR \-o ,
  102. .I cpio
  103. works in
  104. .RI ` copy-out '
  105. mode,
  106. creates archives
  107. and writes them to standard output per default.
  108. A list of filenames to be included in the archive is
  109. read from standard input;
  110. if the name of a directory appears,
  111. it is included in the archive,
  112. but
  113. .I cpio
  114. will not include any of its members
  115. unless they are explicitly given in addition.
  116. The
  117. .IR find (1)
  118. utility is useful to generate a list of files
  119. (see also its
  120. .I \-cpio
  121. and
  122. .I \-ncpio
  123. operators).
  124. When producing a filename list for
  125. .IR cpio ,
  126. find should always be invoked with
  127. .I \-depth
  128. since this makes it possible to extract write-protected directories
  129. for users other than the super-user.
  130. .PP
  131. The
  132. .B \-p
  133. option selects
  134. .RI ` pass '
  135. mode;
  136. a list of files is read from standard input as described for
  137. .IR \-o ;
  138. files are copied to the specified
  139. .IR directory ,
  140. preserving attributes as described for
  141. .IR \-i .
  142. Special files are re-created in the target hierarchy,
  143. and hard links between copied files are preserved.
  144. .PP
  145. When a premature end-of-file is detected with
  146. .I \-i
  147. and
  148. .I \-o
  149. and the archive is a block or character special file,
  150. the user is prompted for new media.
  151. .PP
  152. The following options alter the behavior of
  153. .IR cpio :
  154. .TP
  155. .B \-a
  156. Resets the access times of files
  157. that were included in the archive with
  158. .I \-o
  159. or copied with
  160. .IR \-p .
  161. .TP
  162. .B \-A
  163. Append files to the archive.
  164. The archive must be seekable,
  165. such as a regular file or a block device,
  166. or a tape device capable of writing between filemarks.
  167. .TP
  168. .B \-b
  169. Swap bytes within each half word
  170. and half words within each word
  171. of input file data.
  172. .TP
  173. .B \-B
  174. Blocks input and output archives at 5120 byte records.
  175. The default blocking size is device dependent.
  176. .TP
  177. .B \-c
  178. Specifies that archive headers are in SVR4 ASCII cpio format.
  179. This option is ignored with
  180. .I \-i
  181. unless the
  182. .I \-k
  183. option is also present.
  184. .TP
  185. \fB\-C\fI size\fR
  186. Blocks input and output archives at
  187. .I size
  188. byte records.
  189. .TP
  190. .B \-d
  191. Creates missing parent directories
  192. for each file extracted from the archive
  193. and allows the extraction of directories.
  194. .TP
  195. \fB\-E\fI file\fR
  196. Each line read from
  197. .I file
  198. is taken as a pattern in addition
  199. to those specified on the command line.
  200. .TP
  201. .B \-f
  202. Reverses the sense of patterns
  203. such that a file that does not match any of the patterns
  204. is selected.
  205. .TP
  206. \fB\-H\fI header\fR
  207. Specifies the archive header format to be one of:
  208. .sp
  209. .in +6
  210. .TS
  211. lfB l.
  212. \fBcrc\fR SVR4 ASCII cpio format with checksum;\
  213. \fBsco\fR T{
  214. SCO UnixWare 7.1 ASCII cpio format;
  215. T}
  216. \fBscocrc\fR T{
  217. SCO UnixWare 7.1 ASCII cpio format with checksum;
  218. T}
  219. \fBodc\fR T{
  220. traditional ASCII cpio format, as standardized in IEEE Std. 1003.1, 1996;
  221. T}
  222. \fBbbs\fR byte-swapped binary cpio format;
  223. \fBsgi\fR T{
  224. SGI IRIX extended binary cpio format;
  225. T}
  226. \fBcray\fR T{
  227. Cray UNICOS 9 cpio format;
  228. T}
  229. \fBcray5\fR T{
  230. Cray UNICOS 5 cpio format;
  231. T}
  232. \fBdec\fR T{
  233. Digital UNIX extended cpio format;
  234. T}
  235. \fBtar\fR tar format;
  236. \fBotar\fR old tar format;
  237. \fBustar\fR T{
  238. IEEE Std. 1003.1, 1996 tar format;
  239. T}
  240. .T&
  241. l s.
  242. \fBpax\fR[\fB:\fIoption\fB,\fR[\fIoption\fB,\fR\|...]]
  243. .T&
  244. l l.
  245. \& T{
  246. IEEE Std. 1003.1, 2001 pax format.
  247. Format-specific \fIoptions\fR are:
  248. .in +2n
  249. .ti 0
  250. .br
  251. \fBlinkdata\fR
  252. .br
  253. For a regular file which has multiple hard links,
  254. the file data is stored once for each link in the archive,
  255. instead of being stored for the first entry only.
  256. This option must be used with care
  257. since many implementations are unable
  258. to read the resulting archive.
  259. .ti 0
  260. .br
  261. \fBtimes\fR
  262. .br
  263. Causes the times of last access and last modification
  264. of each archived file
  265. to be stored in an extended \fIpax\fR header.
  266. This in particular allows the time of last access
  267. to be restored when the archive is read.
  268. .br
  269. .in -2n
  270. T}
  271. \fBsun\fR T{
  272. Sun Solaris 7 extended tar format;
  273. T}
  274. \fBgnu\fR T{
  275. GNU tar format;
  276. T}
  277. \fBbar\fR T{
  278. SunOS 4 bar format;
  279. T}
  280. \fBzip\fR[\fB:\fIcc\fR] T{
  281. zip format with optional compression method.
  282. If \fIcc\fR is one of
  283. \fBen\fR (normal, default),
  284. \fBex\fR (extra),
  285. \fBef\fR (fast),
  286. or
  287. \fBes\fR (super fast),
  288. the standard \fIdeflate\fR compression is used.
  289. \fBe0\fR selects no compression,
  290. and
  291. \fBbz2\fR selects \fIbzip2\fR compression.
  292. T}
  293. .TE
  294. .in -6
  295. .sp
  296. This option is ignored with
  297. .I \-i
  298. unless the
  299. .I \-k
  300. option is also present.
  301. The default for
  302. .I \-o
  303. is binary cpio format.
  304. .TP
  305. \fB\-I\fI\ file\fR
  306. Selects a
  307. .I file
  308. that is read with the
  309. .I \-i
  310. option instead of standard input.
  311. .TP
  312. .B \-k
  313. Try to continue operation on read errors and invalid headers.
  314. If an archive contains another archive,
  315. files from either archive may be chosen.
  316. .TP
  317. .B \-l
  318. Link files instead of copying them with
  319. .I \-p
  320. if possible.
  321. .TP
  322. .B \-L
  323. Follow symbolic links when reading files with
  324. .I \-o
  325. or
  326. .IR \-p .
  327. .TP
  328. .B \-m
  329. Restore modification times of extracted files
  330. to those given in the archive.
  331. .TP
  332. \fB\-M\fI message\fR
  333. The given
  334. .I message
  335. is printed instead of the standard one
  336. with
  337. .I \-I
  338. or
  339. .I \-O
  340. when changing media.
  341. .TP
  342. \fB\-O\fI file\fR
  343. Selects an archive
  344. .I file
  345. that is written instead of standard output
  346. with the
  347. .I \-o
  348. option.
  349. .TP
  350. .B \-P
  351. In copy-out or pass mode,
  352. interpret the data read from standard input
  353. as prototype lines
  354. of colon-separated fields
  355. of the form
  356. .in +3m
  357. .sp
  358. \fItype\fB:\fIuser\fB:\fIgroup\fB:\fImode\fB:\fIatime\fB:\fImtime\fB:\fImajor\fB:\fIminor\fB:\fIpath\fR
  359. .sp
  360. .in -3m
  361. For each non-empty field,
  362. the corresponding attribute of the input file is overridden.
  363. With this option,
  364. an unprivileged user can create
  365. an archive that contains files
  366. with arbitrary attributes.
  367. The meanings of the individual fields are:
  368. .RS
  369. .TP 6
  370. .PD 0
  371. .I type
  372. File type, one of:
  373. \fBb\fR (block device),
  374. \fBc\fR (character device),
  375. \fBd\fR (directory),
  376. \fBf\fR (plain file),
  377. \fBp\fR (named pipe),
  378. or
  379. \fBs\fR (symbolic link).
  380. .TP
  381. .I user
  382. The owner of the file,
  383. which can be a numeric user ID or a user name.
  384. .TP
  385. .I group
  386. The group owner of the file,
  387. which can be a numeric group ID or a group name.
  388. .TP
  389. .I mode
  390. The octal mode of the file.
  391. .TP
  392. .I atime
  393. The time the file was last accessed.
  394. Note that most archive formats cannot store this attribute,
  395. in which case it is ignored.
  396. The format is the same as that of the
  397. .I mtime
  398. field.
  399. .TP
  400. .I mtime
  401. The time the file was last modified.
  402. This is either a decimal integer
  403. specifying the seconds past the epoch,
  404. or an ISO\ 8601 date and time field
  405. of the format \fIYYYYMMDD\fBT\fIHHMMSS\fR,
  406. e.g. 20070326T190511,
  407. the latter being relative to the current time zone
  408. and with all digits past the \fBT\fR being optional.
  409. .TP
  410. .I major minor
  411. Major and minor device numbers as with
  412. .IR mknod (1M).
  413. These fields are only allowed for block and character devices.
  414. .TP
  415. .I path
  416. The name of the file to be archived.
  417. If the file is not a symbolic link,
  418. and the specification is otherwise sufficient,
  419. the file needs not exist
  420. at the time the archive is created.
  421. A non-existent regular file will be empty in the archive.
  422. .PD
  423. .RE
  424. .IP
  425. This option is an extension.
  426. .TP
  427. .B \-r
  428. Rename files interactively.
  429. Before a file is extracted from the archive,
  430. its file name is printed on standard error
  431. and the user is prompted to specify a substitute file name.
  432. If the line read from the terminal is empty,
  433. the file is skipped;
  434. if the line consists of a single dot,
  435. the name is retained;
  436. otherwise,
  437. the line forms the new file name.
  438. .TP
  439. \fB\-R\fI user\fR
  440. Set the ownership of extracted files
  441. to the user and group ids of
  442. .I user
  443. instead of those specified in the archive.
  444. Valid only for the super-user.
  445. .TP
  446. .B \-s
  447. Swap bytes within each half word
  448. of input file data.
  449. .TP
  450. .B \-S
  451. Swap half words within each word
  452. of input file data.
  453. .TP
  454. .B \-t
  455. When combined with the
  456. .I \-o
  457. option,
  458. a list of files in the archive is written to standard output;
  459. no files are extracted.
  460. .TP
  461. .B \-u
  462. .I Cpio
  463. will overwrite existing target files
  464. that were modified more recently than the file in the archive
  465. when this option is given.
  466. .TP
  467. .B \-v
  468. Prints the file names of archived or extracted files with
  469. .I \-i
  470. and
  471. .I \-o
  472. and a verbose output format with
  473. .IR \-t .
  474. If given twice
  475. .RB ( \-vv )
  476. in combination with
  477. .I \-t
  478. when reading a
  479. .I zip
  480. archive,
  481. information about compression level and method is printed.
  482. .TP
  483. .B \-V
  484. Prints a dot for each archived or extracted file.
  485. .TP
  486. .B \-6
  487. Selects Unix 6th Edition archive format
  488. (only in copy-in mode).
  489. .PP
  490. .ne 37
  491. Characteristics of archive formats are as follows:
  492. .sp
  493. .TS
  494. allbox;
  495. l r r r l
  496. l1fB r2 n2 r2 c.
  497. T{
  498. .ad l
  499. maximum user/\%group id
  500. T} T{
  501. .ad l
  502. maximum file size
  503. T} T{
  504. .ad l
  505. maximum pathname length
  506. T} T{
  507. .ad l
  508. bits in dev_t (major/minor)
  509. T}
  510. binary 65535 2 GB\ 256 \ 16
  511. \-H\ sgi 65535 9 EB\ 256 \ 14/18
  512. \-H\ odc 262143 8 GB\ 256 \ 18
  513. \-H\ dec 262143 8 GB\ 256 \ 24/24
  514. T{
  515. \-c, \-H\ crc
  516. T} 4.3e9 4 GB\ 1024 \ 32/32
  517. T{
  518. \-H\ sco, \-H\ scocrc
  519. T} 4.3e9 9 EB\ 1024 \ 32/32
  520. T{
  521. \-H\ cray, \-H\ cray5
  522. T} 1.8e19 9 EB\ 65535 \ 64
  523. \-H\ otar 2097151 8 GB\ 99 \ n/a
  524. T{
  525. \-H\ tar,
  526. \-H\ ustar
  527. T} 2097151 8 GB\ 256 (99) \ 21/21
  528. \-H\ pax 1.8e19 9 EB\ 65535 \ 21/21
  529. \-H\ sun 1.8e19 9 EB\ 65535 \ 63/63
  530. \-H\ gnu 1.8e19 9 EB\ 65535 \ 63/63
  531. \-H\ bar 2097151 8 GB\ 427 \ 21
  532. \-H\ zip 4.3e9 9 EB\ 60000 \ 32
  533. .TE
  534. .sp
  535. .PP
  536. By default,
  537. .B binary
  538. cpio archives are written.
  539. The byte order of such archives
  540. depends on the machine
  541. on which the archive is created.
  542. Unlike some other implementations,
  543. .I cpio
  544. fully supports
  545. archives of either byte order.
  546. .I \-H\ bbs
  547. can be used to create an archive
  548. with the byte order opposed to that of the current machine.
  549. .PP
  550. The
  551. .B sgi
  552. format extends the binary format
  553. to handle larger files and more device bits.
  554. If an archive does not contain any entries
  555. that actually need the extensions,
  556. it is identical to a binary archive.
  557. .I \-H\ sgi
  558. archives are always created in MSB order.
  559. .PP
  560. The
  561. .B odc
  562. format was introduced with System\ III
  563. and standardized with IEEE Std. 1003.1.
  564. All known
  565. .I cpio
  566. implementations since around 1980 can read this format.
  567. .PP
  568. The
  569. .B dec
  570. format extends the
  571. .I odc
  572. format
  573. to support more device bits.
  574. Archives in this format are generally incompatible with
  575. .I odc
  576. archives
  577. and need special implementation support to be read.
  578. .PP
  579. The
  580. .B \-c
  581. format was introduced with System\ V Release\ 4.
  582. Except for the file size,
  583. it imposes no practical limitations
  584. on files archived.
  585. The original SVR4 implementation
  586. stores the contents of hard linked files
  587. only once and with the last archived link.
  588. This
  589. .I cpio
  590. ensures compatibility with SVR4.
  591. With archives created by implementations that employ other methods
  592. for storing hard linked files,
  593. each file is extracted as a single link,
  594. and some of these files may be empty.
  595. Implementations that expect methods other than the original SVR4 one
  596. may extract no data for hard linked files at all.
  597. .PP
  598. The
  599. .B crc
  600. format is essentially the same as the
  601. .I \-c
  602. format
  603. but adds a simple checksum (not a CRC, despite its name)
  604. for the data of regular files.
  605. The checksum requires the implementation to read each file twice,
  606. which can considerably increase running time and system overhead.
  607. As not all implementations claiming to support this format
  608. handle the checksum correctly,
  609. it is of limited use.
  610. .PP
  611. The
  612. .B sco
  613. and
  614. .B scocrc
  615. formats are variants of the
  616. .I \-c
  617. and
  618. .I \-H\ crc
  619. formats, respectively,
  620. with extensions to support larger files.
  621. The extensions result in a different archive format
  622. only if files larger than slightly below 2\ GB occur.
  623. .PP
  624. The
  625. .B cray
  626. format extends all header fields to 64 bits.
  627. It thus imposes no practical limitations of any kind
  628. on archived files,
  629. but requires special implementation support
  630. to be read.
  631. Although it is originally a binary format,
  632. the byte order is always MSB as on Cray machines.
  633. The
  634. .B cray5
  635. format is an older variant
  636. that was used with UNICOS 5 and earlier.
  637. .PP
  638. The
  639. .B otar
  640. format was introduced with the Unix 7th Edition
  641. .I tar
  642. utility.
  643. Archives in this format
  644. can be read on all Unix systems since about 1980.
  645. It can only hold regular files
  646. (and, on more recent systems, symbolic links).
  647. For file names that contain characters with the most significant bit set
  648. (non-ASCII characters),
  649. implementations differ in the interpretation of the header checksum.
  650. .PP
  651. The
  652. .B ustar
  653. format was introduced with IEEE Std. 1003.1.
  654. It extends the old
  655. .I tar
  656. format
  657. with support for directories, device files,
  658. and longer file names.
  659. Pathnames of single-linked files can consist of up to 256 characters,
  660. dependent on the position of slashes.
  661. Files with multiple links can only be archived
  662. if the first link encountered is no longer than 100 characters.
  663. Due to implementation errors,
  664. file names longer than 99 characters
  665. can not considered to be generally portable.
  666. Another addition of the
  667. .I ustar
  668. format
  669. are fields for the symbolic user and group IDs.
  670. These fields are created by
  671. .IR cpio ,
  672. but ignored when reading such archives.
  673. .PP
  674. With
  675. .BR "\-H tar" ,
  676. a variant of the
  677. .I ustar
  678. format is selected
  679. which stores file type bits in the mode field
  680. to work around common implementation problems.
  681. These bits are ignored by
  682. .I cpio
  683. when reading archives.
  684. .PP
  685. The
  686. .B pax
  687. format is an extension to the
  688. .I ustar
  689. format.
  690. If attributes cannot be archived with
  691. .IR ustar ,
  692. an extended header is written.
  693. Unless the size of an entry is greater than 8\ GB,
  694. a
  695. .I pax
  696. archive should be readable by any implementation
  697. capable of reading
  698. .I ustar
  699. archives,
  700. although files may be extracted under wrong names
  701. and extended headers may be extracted as separate files.
  702. If a file name contains non-UTF-8 characters,
  703. it may not be archived or extracted correctly
  704. because of a problem of the
  705. .I pax
  706. format specification.
  707. .PP
  708. The
  709. .B sun
  710. format extends the
  711. .I ustar
  712. format similar as the
  713. .I pax
  714. format does.
  715. The extended headers in
  716. .I sun
  717. format archives are not understood
  718. by implementations that support only the
  719. .I pax
  720. format and vice-versa.
  721. The
  722. .I sun
  723. format has also problems with non-UTF-8 characters in file names.
  724. .PP
  725. The
  726. .B GNU
  727. .I tar
  728. format is mostly compatible with the other
  729. .I tar
  730. formats,
  731. unless an archive entry actually uses its extended features.
  732. There are no practical limitations on files archived with this format.
  733. The implementation of
  734. .I cpio
  735. is limited to expanded numerical fields
  736. and long file names;
  737. in particular,
  738. there is no support for sparse files or incremental backups.
  739. If
  740. .I cpio
  741. creates a multi-volume
  742. .I GNU
  743. archive,
  744. it just splits a single-volume archive in multiple parts,
  745. as with the other formats;
  746. .I GNU
  747. multi-volume archives are not supported.
  748. .PP
  749. The
  750. .B bar
  751. format is similar to the
  752. .I tar
  753. format, but can store longer file names.
  754. It requires special implementation support to be read.
  755. .PP
  756. The
  757. .B zip
  758. format can be read in many non-Unix environments.
  759. There are several restrictions on archives
  760. intended for data exchange:
  761. only regular files should be stored;
  762. file times, permissions and ownerships
  763. might be ignored by other implementations;
  764. there should be no more than 65536 files in the archive;
  765. the total archive size should not exceed 2 GB;
  766. only
  767. .I deflate
  768. compression should be used.
  769. Otherwise,
  770. .I cpio
  771. stores all information available with other archive formats
  772. in extended
  773. .I zip
  774. file headers,
  775. so if archive portability is of no concern,
  776. the
  777. .I zip
  778. implementation in
  779. .I cpio
  780. can archive complete Unix file hierarchies.
  781. .I Cpio
  782. supports the
  783. .I zip64
  784. format extension for large files;
  785. it automatically writes
  786. .I zip64
  787. entries if necessary.
  788. .I Cpio
  789. can extract all known
  790. .I zip
  791. format compression codes.
  792. It does not support
  793. .I zip
  794. encryption.
  795. Multi-volume
  796. .I zip
  797. archives are created as splitted single-volume archives,
  798. as with the other formats written by
  799. .IR cpio ;
  800. generic multi-volume
  801. .I zip
  802. archives are not supported.
  803. .SH EXAMPLES
  804. Extract all files named
  805. .I Makefile
  806. or
  807. .I makefile
  808. from the archive stored on
  809. .IR /dev/rmt/c0s0 ,
  810. overwriting recent files:
  811. .RS 2
  812. .sp
  813. cpio \-idmu \-I /dev/rmt/c0s0 \'[Mm]akefile\' \'*/[Mm]akefile\'
  814. .RE
  815. .PP
  816. List the files contained in a software distribution archive:
  817. .RS 2
  818. .sp
  819. cpio \-itv \-I distribution.tar.gz
  820. .RE
  821. .PP
  822. Write a
  823. .IR gzip (1)
  824. compressed
  825. .I ustar
  826. archive containing all files below the directory
  827. .I \%project
  828. to the file
  829. .IR \%project.tar.gz ,
  830. excluding all directories named
  831. .I CVS
  832. or
  833. .I SCCS
  834. and their contents:
  835. .RS 2
  836. .sp
  837. find project \-depth \-print | egrep \-v \'/(CVS|SCCS)(/|$)\' |
  838. .br
  839. cpio \-o \-H ustar | gzip \-c > project.tar.gz
  840. .RE
  841. .PP
  842. Copy the directory
  843. .I work
  844. and its contents
  845. to the directory
  846. .IR \%savedfiles :
  847. .RS 2
  848. .sp
  849. find work \-depth \-print | cpio \-pdm savedfiles
  850. .RE
  851. .PP
  852. Self-extracting zip archives are not automatically recognized,
  853. but can normally be read using the
  854. .I \-k
  855. option, as with
  856. .RS 2
  857. .sp
  858. cpio \-itvk \-H zip \-I archive.exe
  859. .sp
  860. .RE
  861. .SH "ENVIRONMENT VARIABLES"
  862. .TP
  863. .BR LANG ", " LC_ALL
  864. See
  865. .IR locale (7).
  866. .TP
  867. .B LC_CTYPE
  868. Selects the mapping of bytes to characters
  869. used for matching patterns.
  870. .TP
  871. .B LC_TIME
  872. Sets the month names printed with
  873. .IR \-tv .
  874. .TP
  875. .B SYSV3
  876. If this variable is set,
  877. the
  878. .I \-c
  879. option has the same effect as \fI\-H odc\fR;
  880. \fB\-H newc\fR can be used
  881. to select SVR4 ASCII format.
  882. The output format of
  883. .I \-tv
  884. is changed, as well as the text of diagnostic messages.
  885. .SH "SEE ALSO"
  886. find(1),
  887. pax(1),
  888. tar(1)
  889. .SH DIAGNOSTICS
  890. .I Cpio
  891. exits with
  892. .sp
  893. .TS
  894. l8fB l.
  895. 0 after successful operation;
  896. 1 on usage errors;
  897. 2 when operation was continued after minor errors;
  898. 3 on fatal error conditions.
  899. .TE
  900. .SH NOTES
  901. Device and inode numbers
  902. are used for hard link recognition
  903. with the various cpio formats.
  904. Since the header space cannot hold
  905. large numbers present in current file systems,
  906. devices and inode numbers are set on a per-archive basis.
  907. This enables hard link recognition with all cpio formats,
  908. but the link connection to files appended with
  909. .I \-A
  910. is not preserved.
  911. .PP
  912. If a numeric user or group id does not fit
  913. within the size of the header field in the selected format,
  914. files are stored with the user id (or group id, respectively)
  915. set to 60001.
  916. .PP
  917. Use of the
  918. .I \-A
  919. option with a
  920. .I zip
  921. format archive may cause data loss
  922. if the archive was not previously created by
  923. .I cpio
  924. itself.
  925. .PP
  926. .I Cpio
  927. cannot store file names that contain newline characters;
  928. see the
  929. .I NOTES
  930. section of
  931. .IR find (1)
  932. for more information.
  933. .PP
  934. If the file names passed to
  935. .I "cpio \-o"
  936. begin with a slash character,
  937. absolute path names are stored in the archive
  938. and will be extracted to these path names later
  939. regardless of the current working directory.
  940. This is normally not advisable,
  941. and relative path names should be passed to
  942. .I cpio
  943. only.