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