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