| 1 | .\" $MirOS: src/bin/pax/cpio.1,v 1.14 2006/06/23 23:16:55 tg Exp $
|
|---|
| 2 | .\" $OpenBSD: cpio.1,v 1.23 2006/01/03 17:22:47 jmc Exp $
|
|---|
| 3 | .\"
|
|---|
| 4 | .\" Copyright (c) 2005 Thorsten Glaser <tg@66h.42h.de>
|
|---|
| 5 | .\" Copyright (c) 1997 SigmaSoft, Th. Lockert
|
|---|
| 6 | .\" All rights reserved.
|
|---|
| 7 | .\"
|
|---|
| 8 | .\" Redistribution and use in source and binary forms, with or without
|
|---|
| 9 | .\" modification, are permitted provided that the following conditions
|
|---|
| 10 | .\" are met:
|
|---|
| 11 | .\" 1. Redistributions of source code must retain the above copyright
|
|---|
| 12 | .\" notice, this list of conditions and the following disclaimer.
|
|---|
| 13 | .\" 2. Redistributions in binary form must reproduce the above copyright
|
|---|
| 14 | .\" notice, this list of conditions and the following disclaimer in the
|
|---|
| 15 | .\" documentation and/or other materials provided with the distribution.
|
|---|
| 16 | .\"
|
|---|
| 17 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 18 | .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 19 | .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 20 | .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 21 | .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 22 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 23 | .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 24 | .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 27 | .\"
|
|---|
| 28 | .Dd June 24, 2006
|
|---|
| 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 M Ar flag
|
|---|
| 42 | .Op Fl O Ar archive
|
|---|
| 43 | .Ar "< name-list"
|
|---|
| 44 | .Op Ar "> archive"
|
|---|
| 45 | .Nm cpio
|
|---|
| 46 | .Fl i
|
|---|
| 47 | .Op Fl bBcdfmrsStuvzZ6
|
|---|
| 48 | .Op Fl C Ar bytes
|
|---|
| 49 | .Op Fl E Ar file
|
|---|
| 50 | .Op Fl F Ar archive
|
|---|
| 51 | .Op Fl H Ar format
|
|---|
| 52 | .Op Fl I Ar archive
|
|---|
| 53 | .Op Ar "pattern ..."
|
|---|
| 54 | .Op Ar "< archive"
|
|---|
| 55 | .Nm cpio
|
|---|
| 56 | .Fl p
|
|---|
| 57 | .Op Fl adlLmuv
|
|---|
| 58 | .Ar destination-directory
|
|---|
| 59 | .Ar "< name-list"
|
|---|
| 60 | .Sh DESCRIPTION
|
|---|
| 61 | The
|
|---|
| 62 | .Nm
|
|---|
| 63 | command copies files to and from a
|
|---|
| 64 | .Nm
|
|---|
| 65 | archive.
|
|---|
| 66 | .Pp
|
|---|
| 67 | The options are as follows:
|
|---|
| 68 | .Bl -tag -width Ds
|
|---|
| 69 | .It Fl o
|
|---|
| 70 | Create an archive.
|
|---|
| 71 | Reads the list of files to store in the
|
|---|
| 72 | archive from standard input, and writes the archive on standard
|
|---|
| 73 | output.
|
|---|
| 74 | .Bl -tag -width Ds
|
|---|
| 75 | .It Fl a
|
|---|
| 76 | Reset the access times on files that have been copied to the
|
|---|
| 77 | archive.
|
|---|
| 78 | .It Fl A
|
|---|
| 79 | Append to the specified archive.
|
|---|
| 80 | .It Fl B
|
|---|
| 81 | Set block size of output to 5120 bytes.
|
|---|
| 82 | .It Fl c
|
|---|
| 83 | Use ASCII format for
|
|---|
| 84 | .Nm
|
|---|
| 85 | header for portability.
|
|---|
| 86 | .It Fl C Ar bytes
|
|---|
| 87 | Set the block size of output to
|
|---|
| 88 | .Ar bytes .
|
|---|
| 89 | .It Fl F Ar archive
|
|---|
| 90 | .It Fl O Ar archive
|
|---|
| 91 | Use the specified file name as the archive to write to.
|
|---|
| 92 | .It Fl H Ar format
|
|---|
| 93 | Write the archive in the specified format.
|
|---|
| 94 | Recognised formats are:
|
|---|
| 95 | .Pp
|
|---|
| 96 | .Bl -tag -width sv4cpio -compact
|
|---|
| 97 | .It Ar bcpio
|
|---|
| 98 | Old binary
|
|---|
| 99 | .Nm
|
|---|
| 100 | format.
|
|---|
| 101 | Selected by
|
|---|
| 102 | .Fl 6 .
|
|---|
| 103 | .It Ar cpio
|
|---|
| 104 | Old octal character
|
|---|
| 105 | .Nm
|
|---|
| 106 | format.
|
|---|
| 107 | Selected by
|
|---|
| 108 | .Fl c .
|
|---|
| 109 | .It Ar sv4cpio
|
|---|
| 110 | SVR4 hex
|
|---|
| 111 | .Nm
|
|---|
| 112 | format.
|
|---|
| 113 | .It Ar sv4crc
|
|---|
| 114 | SVR4 hex
|
|---|
| 115 | .Nm
|
|---|
| 116 | format with checksums.
|
|---|
| 117 | This is the default format for creating new archives.
|
|---|
| 118 | .It Ar tar
|
|---|
| 119 | Old tar format.
|
|---|
| 120 | .It Ar ustar
|
|---|
| 121 | POSIX ustar format.
|
|---|
| 122 | .It "\ "
|
|---|
| 123 | .It Ar bin
|
|---|
| 124 | These
|
|---|
| 125 | .It Ar crc
|
|---|
| 126 | four
|
|---|
| 127 | .It Ar newc
|
|---|
| 128 | formats
|
|---|
| 129 | .It Ar odc
|
|---|
| 130 | are supported for backwards compatibility only.
|
|---|
| 131 | .El
|
|---|
| 132 | .It Fl L
|
|---|
| 133 | Follow symbolic links.
|
|---|
| 134 | .It Fl M Ar flag
|
|---|
| 135 | Configure the archive normaliser.
|
|---|
| 136 | .Ar flag
|
|---|
| 137 | is either a numeric value compatible to
|
|---|
| 138 | .Xr strtonum 3
|
|---|
| 139 | which is directly stored in the flags word, or
|
|---|
| 140 | one of the following values, prefixed with
|
|---|
| 141 | .Dq no-
|
|---|
| 142 | to turn them off, or not, to turn them on:
|
|---|
| 143 | .Pp
|
|---|
| 144 | .Bl -tag -width xxxxxx -compact
|
|---|
| 145 | .It Ar inodes
|
|---|
| 146 | 0x0001: Serialise inodes, zero device info.
|
|---|
| 147 | .It Ar links
|
|---|
| 148 | 0x0002: Store content of hard links only once.
|
|---|
| 149 | .It Ar mtime
|
|---|
| 150 | 0x0004: Zero out the file modification time.
|
|---|
| 151 | .It Ar uidgid
|
|---|
| 152 | 0x0008: Set owner to 0:0 (root:wheel).
|
|---|
| 153 | .It Ar dist
|
|---|
| 154 | 0x000B: Clean everything except mtime.
|
|---|
| 155 | .It Ar set
|
|---|
| 156 | 0x0003: Keep ownership and mtime intact.
|
|---|
| 157 | .It Ar norm
|
|---|
| 158 | 0x000F: Clean everything.
|
|---|
| 159 | .It Ar root
|
|---|
| 160 | 0x0009: Clean owner and device information.
|
|---|
| 161 | .It Ar verb
|
|---|
| 162 | 0x0010: Debug this option.
|
|---|
| 163 | .It Ar debug
|
|---|
| 164 | 0x0020: Debug file header storage.
|
|---|
| 165 | .El
|
|---|
| 166 | .Pp
|
|---|
| 167 | This option is only implemented for the cpio, sv4cpio,
|
|---|
| 168 | ustar, and sv4crc file format writing routines.
|
|---|
| 169 | For the ustar format, the
|
|---|
| 170 | .Ar inodes
|
|---|
| 171 | and
|
|---|
| 172 | .Ar links
|
|---|
| 173 | specifiers are ignored.
|
|---|
| 174 | .It Fl v
|
|---|
| 175 | Be verbose about operations.
|
|---|
| 176 | List filenames as they are written to the archive.
|
|---|
| 177 | .It Fl z
|
|---|
| 178 | Compress archive using
|
|---|
| 179 | .Xr gzip 1
|
|---|
| 180 | format.
|
|---|
| 181 | .It Fl Z
|
|---|
| 182 | Compress archive using
|
|---|
| 183 | .Xr compress 1
|
|---|
| 184 | format.
|
|---|
| 185 | .El
|
|---|
| 186 | .It Fl i
|
|---|
| 187 | Restore files from an archive.
|
|---|
| 188 | Reads the archive file from
|
|---|
| 189 | standard input and extracts files matching the
|
|---|
| 190 | .Ar patterns
|
|---|
| 191 | that were specified on the command line.
|
|---|
| 192 | .Bl -tag -width Ds
|
|---|
| 193 | .It Fl b
|
|---|
| 194 | Do byte and word swapping after reading in data from the
|
|---|
| 195 | archive, for restoring archives created on systems with
|
|---|
| 196 | a different byte order.
|
|---|
| 197 | .It Fl B
|
|---|
| 198 | Set the block size of the archive being read to 5120 bytes.
|
|---|
| 199 | .It Fl c
|
|---|
| 200 | Expect the archive headers to be in ASCII format.
|
|---|
| 201 | .It Fl C Ar bytes
|
|---|
| 202 | Read archive written with a block size of
|
|---|
| 203 | .Ar bytes .
|
|---|
| 204 | .It Fl d
|
|---|
| 205 | Create any intermediate directories as needed during
|
|---|
| 206 | restore.
|
|---|
| 207 | .It Fl E Ar file
|
|---|
| 208 | Read list of file name patterns to extract or list from
|
|---|
| 209 | .Ar file .
|
|---|
| 210 | .It Fl f
|
|---|
| 211 | Restore all files except those matching the
|
|---|
| 212 | .Ar patterns
|
|---|
| 213 | given on the command line.
|
|---|
| 214 | .It Fl F Ar archive
|
|---|
| 215 | .It Fl I Ar archive
|
|---|
| 216 | Use the specified file as the input for the archive.
|
|---|
| 217 | .It Fl H Ar format
|
|---|
| 218 | Read an archive of the specified format.
|
|---|
| 219 | Recognised formats are:
|
|---|
| 220 | .Pp
|
|---|
| 221 | .Bl -tag -width sv4cpio -compact
|
|---|
| 222 | .It Ar bcpio
|
|---|
| 223 | Old binary
|
|---|
| 224 | .Nm
|
|---|
| 225 | format.
|
|---|
| 226 | .It Ar cpio
|
|---|
| 227 | Old octal character
|
|---|
| 228 | .Nm
|
|---|
| 229 | format.
|
|---|
| 230 | .It Ar sv4cpio
|
|---|
| 231 | SVR4 hex
|
|---|
| 232 | .Nm
|
|---|
| 233 | format.
|
|---|
| 234 | .It Ar sv4crc
|
|---|
| 235 | SVR4 hex
|
|---|
| 236 | .Nm
|
|---|
| 237 | format with checksums.
|
|---|
| 238 | .It Ar tar
|
|---|
| 239 | Old tar format.
|
|---|
| 240 | .It Ar ustar
|
|---|
| 241 | POSIX ustar format.
|
|---|
| 242 | .It "\ "
|
|---|
| 243 | .It Ar bin
|
|---|
| 244 | These
|
|---|
| 245 | .It Ar crc
|
|---|
| 246 | four
|
|---|
| 247 | .It Ar newc
|
|---|
| 248 | formats
|
|---|
| 249 | .It Ar odc
|
|---|
| 250 | are supported for backwards compatibility only.
|
|---|
| 251 | .El
|
|---|
| 252 | .It Fl m
|
|---|
| 253 | Restore modification times on files.
|
|---|
| 254 | .It Fl r
|
|---|
| 255 | Rename restored files interactively.
|
|---|
| 256 | .It Fl s
|
|---|
| 257 | Swap bytes after reading data from the archive.
|
|---|
| 258 | .It Fl S
|
|---|
| 259 | Swap words after reading data from the archive.
|
|---|
| 260 | .It Fl t
|
|---|
| 261 | Only list the contents of the archive, no files or
|
|---|
| 262 | directories will be created.
|
|---|
| 263 | .It Fl u
|
|---|
| 264 | Overwrite files even when the file in the archive is
|
|---|
| 265 | older than the one that will be overwritten.
|
|---|
| 266 | .It Fl v
|
|---|
| 267 | Be verbose about operations.
|
|---|
| 268 | List filenames as they are copied in from the archive.
|
|---|
| 269 | .It Fl z
|
|---|
| 270 | Uncompress archive using
|
|---|
| 271 | .Xr gzip 1
|
|---|
| 272 | format.
|
|---|
| 273 | .It Fl Z
|
|---|
| 274 | Uncompress archive using
|
|---|
| 275 | .Xr compress 1
|
|---|
| 276 | format.
|
|---|
| 277 | .It Fl 6
|
|---|
| 278 | Process old-style
|
|---|
| 279 | .Nm
|
|---|
| 280 | format archives.
|
|---|
| 281 | .El
|
|---|
| 282 | .It Fl p
|
|---|
| 283 | Copy files from one location to another in a single pass.
|
|---|
| 284 | The list of files to copy are read from standard input and
|
|---|
| 285 | written out to a directory relative to the specified
|
|---|
| 286 | .Ar directory
|
|---|
| 287 | argument.
|
|---|
| 288 | .Bl -tag -width Ds
|
|---|
| 289 | .It Fl a
|
|---|
| 290 | Reset the access times on files that have been copied.
|
|---|
| 291 | .It Fl d
|
|---|
| 292 | Create any intermediate directories as needed to write
|
|---|
| 293 | the files at the new location.
|
|---|
| 294 | .It Fl l
|
|---|
| 295 | When possible, link files rather than creating an
|
|---|
| 296 | extra copy.
|
|---|
| 297 | .It Fl L
|
|---|
| 298 | Follow symbolic links.
|
|---|
| 299 | .It Fl m
|
|---|
| 300 | Restore modification times on files.
|
|---|
| 301 | .It Fl u
|
|---|
| 302 | Overwrite files even when the original file being copied is
|
|---|
| 303 | older than the one that will be overwritten.
|
|---|
| 304 | .It Fl v
|
|---|
| 305 | Be verbose about operations.
|
|---|
| 306 | List filenames as they are copied.
|
|---|
| 307 | .El
|
|---|
| 308 | .El
|
|---|
| 309 | .Sh ENVIRONMENT
|
|---|
| 310 | .Bl -tag -width Fl
|
|---|
| 311 | .It Ev TMPDIR
|
|---|
| 312 | Path in which to store temporary files.
|
|---|
| 313 | .El
|
|---|
| 314 | .Sh ERRORS
|
|---|
| 315 | .Nm
|
|---|
| 316 | will exit with one of the following values:
|
|---|
| 317 | .Bl -tag -width 2n
|
|---|
| 318 | .It 0
|
|---|
| 319 | All files were processed successfully.
|
|---|
| 320 | .It 1
|
|---|
| 321 | An error occurred.
|
|---|
| 322 | .El
|
|---|
| 323 | .Pp
|
|---|
| 324 | Whenever
|
|---|
| 325 | .Nm
|
|---|
| 326 | cannot create a file or a link when extracting an archive or cannot
|
|---|
| 327 | find a file while writing an archive, or cannot preserve the user
|
|---|
| 328 | ID, group ID, file mode, or access and modification times when the
|
|---|
| 329 | .Fl p
|
|---|
| 330 | option is specified, a diagnostic message is written to standard
|
|---|
| 331 | error and a non-zero exit value will be returned, but processing
|
|---|
| 332 | will continue.
|
|---|
| 333 | In the case where
|
|---|
| 334 | .Nm
|
|---|
| 335 | cannot create a link to a file,
|
|---|
| 336 | .Nm
|
|---|
| 337 | will not create a second copy of the file.
|
|---|
| 338 | .Pp
|
|---|
| 339 | If the extraction of a file from an archive is prematurely terminated
|
|---|
| 340 | by a signal or error,
|
|---|
| 341 | .Nm
|
|---|
| 342 | may have only partially extracted the file the user wanted.
|
|---|
| 343 | Additionally, the file modes of extracted files and directories may
|
|---|
| 344 | have incorrect file bits, and the modification and access times may
|
|---|
| 345 | be wrong.
|
|---|
| 346 | .Pp
|
|---|
| 347 | If the creation of an archive is prematurely terminated by a signal
|
|---|
| 348 | or error,
|
|---|
| 349 | .Nm
|
|---|
| 350 | may have only partially created the archive, which may violate the
|
|---|
| 351 | specific archive format specification.
|
|---|
| 352 | .Sh SEE ALSO
|
|---|
| 353 | .Xr pax 1 ,
|
|---|
| 354 | .Xr tar 1
|
|---|
| 355 | .Sh AUTHORS
|
|---|
| 356 | Keith Muller at the University of California, San Diego.
|
|---|
| 357 | .Sh CAVEATS
|
|---|
| 358 | Different file formats have different maximum file sizes.
|
|---|
| 359 | It is recommended that a format such as cpio or ustar
|
|---|
| 360 | be used for larger files.
|
|---|
| 361 | .Pp
|
|---|
| 362 | .Bl -column "File format" "Maximum file size" -offset indent -compact
|
|---|
| 363 | .It Sy "File format" Ta Sy "Maximum file size"
|
|---|
| 364 | .It bcpio Ta 4 Gibibytes
|
|---|
| 365 | .It sv4cpio Ta 4 Gibibytes
|
|---|
| 366 | .It cpio Ta 8 Gibibytes
|
|---|
| 367 | .It tar Ta 8 Gibibytes
|
|---|
| 368 | .It ustar Ta 8 Gibibytes
|
|---|
| 369 | .El
|
|---|
| 370 | .Sh BUGS
|
|---|
| 371 | The
|
|---|
| 372 | .Fl s
|
|---|
| 373 | and
|
|---|
| 374 | .Fl S
|
|---|
| 375 | options are currently not implemented.
|
|---|
| 376 | .Sh CAVEATS
|
|---|
| 377 | The backwards-compatible format options are not available in the
|
|---|
| 378 | .Xr pax 1
|
|---|
| 379 | front-end.
|
|---|
| 380 | .Pp
|
|---|
| 381 | The
|
|---|
| 382 | .Fl M
|
|---|
| 383 | option is a MirOS extensions, available starting with
|
|---|
| 384 | .Mx 8 .
|
|---|
| 385 | Archives written using these options are, however, compatible to
|
|---|
| 386 | the standard and should be readable on any other system.
|
|---|
| 387 | The only option whose behaviour is not explicitly allowed by the
|
|---|
| 388 | standard is hard link unification (write file contens only once)
|
|---|
| 389 | selected by
|
|---|
| 390 | .Fl M Ar 0x0002 .
|
|---|