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