bbc4ab9f1c281777c3bc5da64eb1438dcab0990e
[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 aABcLvzZ
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 bBcdfmrsStuvzZ6
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 L
110 Follow symbolic links.
111 .It Fl v
112 Be verbose about operations.  List filenames as they are
113 written to the archive.
114 .It Fl z
115 Compress archive using
116 .Xr gzip 1
117 format.
118 .It Fl Z
119 Compress archive using
120 .Xr compress 1
121 format.
122 .El
123 .It Fl i
124 Restore files from an archive.  Reads the archive file from
125 standard input and extracts files matching the
126 .Ar patterns
127 that were specified on the command line.
128 .Bl -tag -width Fl
129 .It Fl b
130 Do byte and word swapping after reading in data from the
131 archive, for restoring archives created on systems with
132 a different byte order.
133 .It Fl B
134 Set the block size of the archive being read to 5120 bytes.
135 .It Fl c
136 Expect the archive headers to be in ASCII format.
137 .It Fl C Ar bytes
138 Read archive written with a block size of
139 .Ar bytes .
140 .It Fl d
141 Create any intermediate directories as needed during
142 restore.
143 .It Fl E Ar file
144 Read list of file name patterns to extract or list from
145 .Ar file .
146 .It Fl f
147 Restore all files except those matching the
148 .Ar patterns
149 given on the command line.
150 .It Fl F Ar archive
151 .It Fl I Ar archive
152 Use the specified file as the input for the archive.
153 .It Fl H Ar format
154 Read an archive of the specified format.  Recognized
155 formats are:
156 .Bl -tag -width Ds
157 .It Ar bcpio
158 Old binary cpio format.
159 .It Ar cpio
160 Old octal character cpio format.
161 .It Ar sv4cpio
162 SVR4 hex cpio format.
163 .It Ar tar
164 Old tar format.
165 .It Ar ustar
166 POSIX ustar format.
167 .El
168 .It Fl m
169 Restore modification times on files.
170 .It Fl r
171 Rename restored files interactively.
172 .It Fl s
173 Swap bytes after reading data from the archive.
174 .It Fl S
175 Swap words after reading data from the archive.
176 .It Fl t
177 Only list the contents of the archive, no files or
178 directories will be created.
179 .It Fl u
180 Overwrite files even when the file in the archive is
181 older than the one that will be overwritten.
182 .It Fl v
183 Be verbose about operations.  List filenames as they are
184 copied in from the archive.
185 .It Fl z
186 Uncompress archive using
187 .Xr gzip 1
188 format.
189 .It Fl Z
190 Uncompress archive using
191 .Xr compress 1
192 format.
193 .It Fl 6
194 Process old-style \*Qcpio\*U format archives.
195 .El
196 .It Fl p
197 Copy files from one location to another in a single pass.
198 The list of files to copy are read from standard input and
199 written out to a directory relative to the specified
200 .Ar directory
201 argument.
202 .Bl -tag -width Fl
203 .It Fl a
204 Reset the access times on files that have been copied.
205 .It Fl d
206 Create any intermediate directories as needed to write
207 the files at the new location.
208 .It Fl l
209 When possible, link files rather than creating an
210 extra copy.
211 .It Fl L
212 Follow symbolic links.
213 .It Fl m
214 Restore modification times on files.
215 .It Fl u
216 Overwrite files even when the original file being copied is
217 older than the one that will be overwritten.
218 .It Fl v
219 Be verbose about operations.  List filenames as they are
220 copied.
221 .El
222 .El
223 .Sh ERRORS
224 .Nm
225 will exit with one of the following values:
226 .Bl -tag -width 2n
227 .It 0
228 All files were processed successfully.
229 .It 1
230 An error occurred.
231 .El
232 .Pp
233 Whenever
234 .Nm
235 cannot create a file or a link when extracting an archive or cannot
236 find a file while writing an archive, or cannot preserve the user
237 ID, group ID, file mode or access and modification times when the
238 .Fl p
239 option is specified, a diagnostic message is written to standard
240 error and a non-zero exit value will be returned, but processing
241 will continue.  In the case where
242 .Nm
243 cannot create a link to a file,
244 .Nm
245 will not create a second copy of the file.
246 .Pp
247 If the extraction of a file from an archive is prematurely terminated
248 by a signal or error,
249 .Nm
250 may have only partially extracted the file the user wanted.
251 Additionally, the file modes of extracted files and directories may
252 have incorrect file bits, and the modification and access times may
253 be wrong.
254 .Pp
255 If the creation of an archive is prematurely terminated by a signal
256 or error,
257 .Nm
258 may have only partially created the archive which may violate the
259 specific archive format specification.
260 .Sh SEE ALSO
261 .Xr pax 1 ,
262 .Xr tar 1
263 .Sh BUGS
264 The 
265 .Fl s
266 and
267 .Fl S
268 options are currently not implemented.
269 .Sh AUTHOR
270 Keith Muller at the University of California, San Diego.