file_cmds-321.40.3.tar.gz
[apple/file_cmds.git] / pax / cpio.1
1 .\"-
2 .\" Copyright (c) 1997 SigmaSoft, Th. Lockert
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 .\"
25 .\"     $OpenBSD: cpio.1,v 1.16 2001/05/01 17:58:01 aaron Exp $
26 .\" $FreeBSD: src/bin/pax/cpio.1,v 1.6 2005/02/09 18:02:29 ru Exp $
27 .\"
28 .Dd February 16, 1997
29 .Dt CPIO 1
30 .Os
31 .Sh NAME
32 .Nm cpio
33 .Nd copy file archives in and out
34 .Sh SYNOPSIS
35 .Nm cpio
36 .Fl o
37 .Op Fl aABcLvzZ
38 .Op Fl C Ar bytes
39 .Op Fl F Ar archive
40 .Op Fl H Ar format
41 .Op Fl O Ar archive
42 .Ar "< name-list"
43 .Op Ar "> archive"
44 .Nm cpio
45 .Fl i
46 .Op Fl bBcdfmrsStuvzZ6
47 .Op Fl C Ar bytes
48 .Op Fl E Ar file
49 .Op Fl F Ar archive
50 .Op Fl H Ar format
51 .Op Fl I Ar archive
52 .Op Ar "pattern ..."
53 .Op Ar "< archive"
54 .Nm cpio
55 .Fl p
56 .Op Fl adlLmuv
57 .Ar destination-directory
58 .No < Ar name-list
59 .Sh DESCRIPTION
60 The
61 .Nm cpio
62 command copies files to and from a
63 .Nm cpio
64 archive.
65 .Pp
66 The options are as follows:
67 .Bl -tag -width Ds
68 .It Fl o
69 Create an archive.
70 Reads the list of files to store in the
71 archive from standard input, and writes the archive on standard
72 output.
73 .Bl -tag -width Ds
74 .It Fl A
75 Append to the specified archive.
76 .It Fl a
77 Reset the access times on files that have been copied to the
78 archive.
79 .It Fl B
80 Set block size of output to 5120 bytes.
81 .It Fl C Ar bytes
82 Set the block size of output to
83 .Ar bytes .
84 .It Fl c
85 Use ASCII format for
86 .Nm cpio
87 header for portability.
88 .It Fl F Ar archive
89 Use the specified file name as the archive to write to.
90 .It Fl H Ar format
91 Write the archive in the specified format.
92 Recognized formats are:
93 .Pp
94 .Bl -tag -width sv4cpio -compact
95 .It Ar bcpio
96 Old binary
97 .Nm cpio
98 format.
99 .It Ar cpio
100 Old octal character
101 .Nm cpio
102 format.
103 .It Ar sv4cpio
104 SVR4 hex
105 .Nm cpio
106 format.
107 .It Ar tar
108 Old tar format.
109 .It Cm ustar
110 .Tn POSIX
111 ustar format.
112 .El
113 .It Fl L
114 Follow symbolic links.
115 .It Fl O Ar archive
116 Use the specified file name as the archive to write to.
117 .It Fl v
118 Be verbose about operations.
119 List filenames as they are written to the archive.
120 .It Fl Z
121 Compress archive using
122 .Xr compress 1
123 format.
124 .It Fl z
125 Compress archive using
126 .Xr gzip 1
127 format.
128 .El
129 .It Fl i
130 Restore files from an archive.
131 Reads the archive file from
132 standard input and extracts files matching the
133 .Ar patterns
134 that were specified on the command line.
135 .Bl -tag -width Ds
136 .It Fl 6
137 Process old-style
138 .Nm cpio
139 format archives.
140 .It Fl B
141 Set the block size of the archive being read to 5120 bytes.
142 .It Fl b
143 Do byte and word swapping after reading in data from the
144 archive, for restoring archives created on systems with
145 a different byte order.
146 .It Fl C Ar bytes
147 Read archive written with a block size of
148 .Ar bytes .
149 .It Fl c
150 Expect the archive headers to be in ASCII format.
151 .It Fl d
152 Create any intermediate directories as needed during
153 restore.
154 .It Fl E Ar file
155 Read list of file name patterns to extract or list from
156 .Ar file .
157 .It Fl F Ar archive
158 Use the specified file as the input for the archive.
159 .It Fl f
160 Restore all files except those matching the
161 .Ar patterns
162 given on the command line.
163 .It Fl H Ar format
164 Read an archive of the specified format.
165 Recognized formats are:
166 .Pp
167 .Bl -tag -width sv4cpio -compact
168 .It Ar bcpio
169 Old binary
170 .Nm cpio
171 format.
172 .It Ar cpio
173 Old octal character
174 .Nm cpio
175 format.
176 .It Ar sv4cpio
177 SVR4 hex
178 .Nm cpio
179 format.
180 .It Ar tar
181 Old tar format.
182 .It Cm ustar
183 .Tn POSIX
184 ustar format.
185 .El
186 .It Fl I Ar archive
187 Use the specified file as the input for the archive.
188 .It Fl m
189 Restore modification times on files.
190 .It Fl r
191 Rename restored files interactively.
192 .It Fl S
193 Swap words after reading data from the archive.
194 .It Fl s
195 Swap bytes after reading data from the archive.
196 .It Fl t
197 Only list the contents of the archive, no files or
198 directories will be created.
199 .It Fl u
200 Overwrite files even when the file in the archive is
201 older than the one that will be overwritten.
202 .It Fl v
203 Be verbose about operations.
204 List filenames as they are copied in from the archive.
205 .It Fl Z
206 Uncompress archive using
207 .Xr compress 1
208 format.
209 .It Fl z
210 Uncompress archive using
211 .Xr gzip 1
212 format.
213 .It Fl Z
214 Uncompress archive using
215 .Xr compress 1
216 format.
217 .It Fl 6
218 Process old-style
219 .Nm
220 format archives.
221 .El
222 .It Fl p
223 Copy files from one location to another in a single pass.
224 The list of files to copy are read from standard input and
225 written out to a directory relative to the specified
226 .Ar directory
227 argument.
228 By default, an older file will not replace a newer file with the same name.
229 .Bl -tag -width Ds
230 .It Fl a
231 Reset the access times on files that have been copied.
232 .It Fl d
233 Create any intermediate directories as needed to write
234 the files at the new location.
235 .It Fl L
236 Follow symbolic links.
237 .It Fl l
238 When possible, link files rather than creating an
239 extra copy.
240 .It Fl m
241 Restore modification times on files.
242 .It Fl u
243 Overwrite files even when the original file being copied is
244 older than the one that will be overwritten.
245 .It Fl v
246 Be verbose about operations.
247 List filenames as they are copied.
248 .El
249 .El
250 .Sh ENVIRONMENT
251 .Bl -tag -width Fl
252 .It Ev TMPDIR
253 Path in which to store temporary files.
254 .El
255 .Sh ERRORS
256 .Nm cpio
257 will exit with one of the following values:
258 .Bl -tag -width 2n
259 .It 0
260 All files were processed successfully.
261 .It 1
262 An error occurred.
263 .El
264 .Pp
265 Whenever
266 .Nm cpio
267 cannot create a file or a link when extracting an archive or cannot
268 find a file while writing an archive, or cannot preserve the user
269 ID, group ID, file mode, or access and modification times when the
270 .Fl p
271 option is specified, a diagnostic message is written to standard
272 error and a non-zero exit value will be returned, but processing
273 will continue.
274 In the case where
275 .Nm cpio
276 cannot create a link to a file,
277 .Nm cpio
278 will not create a second copy of the file.
279 .Pp
280 If the extraction of a file from an archive is prematurely terminated
281 by a signal or error,
282 .Nm cpio
283 may have only partially extracted the file the user wanted.
284 Additionally, the file modes of extracted files and directories may
285 have incorrect file bits, and the modification and access times may
286 be wrong.
287 .Pp
288 If the creation of an archive is prematurely terminated by a signal
289 or error,
290 .Nm cpio
291 may have only partially created the archive, which may violate the
292 specific archive format specification.
293 .Sh SEE ALSO
294 .Xr pax 1 ,
295 .Xr tar 1
296 .Sh AUTHORS
297 .An Keith Muller
298 at the University of California, San Diego.
299 .Sh BUGS
300 The
301 .Fl s
302 and
303 .Fl S
304 options are currently not implemented.