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.16 2001/05/01 17:58:01 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 64The 65.Nm 66command copies files to and from a 67.Nm 68archive. 69.Pp 70The options are as follows: 71.Bl -tag -width Ds 72.It Fl o 73Create an archive. 74Reads the list of files to store in the 75archive from standard input, and writes the archive on standard 76output. 77.Bl -tag -width Ds 78.It Fl a 79Reset the access times on files that have been copied to the 80archive. 81.It Fl A 82Append to the specified archive. 83.It Fl B 84Set block size of output to 5120 bytes. 85.It Fl c 86Use ASCII format for 87.Nm 88header for portability. 89.It Fl C Ar bytes 90Set the block size of output to 91.Ar bytes . 92.It Fl F Ar archive 93.It Fl O Ar archive 94Use the specified file name as the archive to write to. 95.It Fl H Ar format 96Write the archive in the specified format. 97Recognized formats are: 98.Pp 99.Bl -tag -width sv4cpio -compact 100.It Ar bcpio 101Old binary 102.Nm 103format. 104.It Ar cpio 105Old octal character 106.Nm 107format. 108.It Ar sv4cpio 109SVR4 hex 110.Nm 111format. 112.It Ar tar 113Old tar format. 114.It Ar ustar 115POSIX ustar format. 116.El 117.It Fl L 118Follow symbolic links. 119.It Fl v 120Be verbose about operations. 121List filenames as they are written to the archive. 122.It Fl z 123Compress archive using 124.Xr gzip 1 125format. 126.It Fl Z 127Compress archive using 128.Xr compress 1 129format. 130.El 131.It Fl i 132Restore files from an archive. 133Reads the archive file from 134standard input and extracts files matching the 135.Ar patterns 136that were specified on the command line. 137.Bl -tag -width Ds 138.It Fl b 139Do byte and word swapping after reading in data from the 140archive, for restoring archives created on systems with 141a different byte order. 142.It Fl B 143Set the block size of the archive being read to 5120 bytes. 144.It Fl c 145Expect the archive headers to be in ASCII format. 146.It Fl C Ar bytes 147Read archive written with a block size of 148.Ar bytes . 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 156Restore all files except those matching the 157.Ar patterns 158given on the command line. 159.It Fl F Ar archive 160.It Fl I Ar archive 161Use the specified file as the input for the archive. 162.It Fl H Ar format 163Read an archive of the specified format. 164Recognized formats are: 165.Pp 166.Bl -tag -width sv4cpio -compact 167.It Ar bcpio 168Old binary 169.Nm 170format. 171.It Ar cpio 172Old octal character 173.Nm 174format. 175.It Ar sv4cpio 176SVR4 hex 177.Nm 178format. 179.It Ar tar 180Old tar format. 181.It Ar ustar 182POSIX ustar format. 183.El 184.It Fl m 185Restore modification times on files. 186.It Fl r 187Rename restored files interactively. 188.It Fl s 189Swap bytes after reading data from the archive. 190.It Fl S 191Swap words after reading data from the archive. 192.It Fl t 193Only list the contents of the archive, no files or 194directories will be created. 195.It Fl u 196Overwrite files even when the file in the archive is 197older than the one that will be overwritten. 198.It Fl v 199Be verbose about operations. 200List filenames as they are copied in from the archive. 201.It Fl z 202Uncompress archive using 203.Xr gzip 1 204format. 205.It Fl Z 206Uncompress archive using 207.Xr compress 1 208format. 209.It Fl 6 210Process old-style 211.Nm 212format archives. 213.El 214.It Fl p 215Copy files from one location to another in a single pass. 216The list of files to copy are read from standard input and 217written out to a directory relative to the specified 218.Ar directory 219argument. 220.Bl -tag -width Ds 221.It Fl a 222Reset the access times on files that have been copied. 223.It Fl d 224Create any intermediate directories as needed to write 225the files at the new location. 226.It Fl l 227When possible, link files rather than creating an 228extra copy. 229.It Fl L 230Follow symbolic links. 231.It Fl m 232Restore modification times on files. 233.It Fl u 234Overwrite files even when the original file being copied is 235older than the one that will be overwritten. 236.It Fl v 237Be verbose about operations. 238List filenames as they are copied. 239.El 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 ENVIRONMENT 280.Bl -tag -width Fl 281.It Ev TMPDIR 282Path in which to store temporary files. 283.El 284.Sh SEE ALSO 285.Xr pax 1 , 286.Xr tar 1 287.Sh AUTHORS 288Keith Muller at the University of California, San Diego. 289.Sh BUGS 290The 291.Fl s 292and 293.Fl S 294options are currently not implemented. 295