1*b73dcc21Schristos.\" $NetBSD: cpio.1,v 1.1 2002/10/12 15:30:54 christos Exp $ 2*b73dcc21Schristos.\" 3*b73dcc21Schristos.\" Copyright (c) 1997 SigmaSoft, Th. Lockert 4*b73dcc21Schristos.\" All rights reserved. 5*b73dcc21Schristos.\" 6*b73dcc21Schristos.\" Redistribution and use in source and binary forms, with or without 7*b73dcc21Schristos.\" modification, are permitted provided that the following conditions 8*b73dcc21Schristos.\" are met: 9*b73dcc21Schristos.\" 1. Redistributions of source code must retain the above copyright 10*b73dcc21Schristos.\" notice, this list of conditions and the following disclaimer. 11*b73dcc21Schristos.\" 2. Redistributions in binary form must reproduce the above copyright 12*b73dcc21Schristos.\" notice, this list of conditions and the following disclaimer in the 13*b73dcc21Schristos.\" documentation and/or other materials provided with the distribution. 14*b73dcc21Schristos.\" 3. All advertising materials mentioning features or use of this software 15*b73dcc21Schristos.\" must display the following acknowledgement: 16*b73dcc21Schristos.\" This product includes software developed by SigmaSoft, Th. Lockert. 17*b73dcc21Schristos.\" 4. The name of the author may not be used to endorse or promote products 18*b73dcc21Schristos.\" derived from this software without specific prior written permission 19*b73dcc21Schristos.\" 20*b73dcc21Schristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21*b73dcc21Schristos.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22*b73dcc21Schristos.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23*b73dcc21Schristos.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24*b73dcc21Schristos.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25*b73dcc21Schristos.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26*b73dcc21Schristos.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27*b73dcc21Schristos.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28*b73dcc21Schristos.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29*b73dcc21Schristos.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30*b73dcc21Schristos.\" 31*b73dcc21Schristos.\" OpenBSD: cpio.1,v 1.14 2000/11/10 17:52:02 aaron Exp 32*b73dcc21Schristos.\" 33*b73dcc21Schristos.Dd February 16, 1997 34*b73dcc21Schristos.Dt CPIO 1 35*b73dcc21Schristos.Os 36*b73dcc21Schristos.Sh NAME 37*b73dcc21Schristos.Nm cpio 38*b73dcc21Schristos.Nd copy file archives in and out 39*b73dcc21Schristos.Sh SYNOPSIS 40*b73dcc21Schristos.Nm cpio 41*b73dcc21Schristos.Fl o 42*b73dcc21Schristos.Op Fl aABcLvzZ 43*b73dcc21Schristos.Op Fl C Ar bytes 44*b73dcc21Schristos.Op Fl F Ar archive 45*b73dcc21Schristos.Op Fl H Ar format 46*b73dcc21Schristos.Op Fl O Ar archive 47*b73dcc21Schristos.Ar "< name-list" 48*b73dcc21Schristos.Op Ar "> archive" 49*b73dcc21Schristos.Nm cpio 50*b73dcc21Schristos.Fl i 51*b73dcc21Schristos.Op Fl bBcdfmrsStuvzZ6 52*b73dcc21Schristos.Op Fl C Ar bytes 53*b73dcc21Schristos.Op Fl E Ar file 54*b73dcc21Schristos.Op Fl F Ar archive 55*b73dcc21Schristos.Op Fl H Ar format 56*b73dcc21Schristos.Op Fl I Ar archive 57*b73dcc21Schristos.Op Ar "pattern ..." 58*b73dcc21Schristos.Op Ar "< archive" 59*b73dcc21Schristos.Nm cpio 60*b73dcc21Schristos.Fl p 61*b73dcc21Schristos.Op Fl adlLmuv 62*b73dcc21Schristos.Ar destination-directory 63*b73dcc21Schristos.Ar "< name-list" 64*b73dcc21Schristos.Sh DESCRIPTION 65*b73dcc21SchristosThe 66*b73dcc21Schristos.Nm 67*b73dcc21Schristoscommand copies files to and from a 68*b73dcc21Schristos.Nm 69*b73dcc21Schristosarchive. 70*b73dcc21Schristos.Pp 71*b73dcc21SchristosThe options are as follows: 72*b73dcc21Schristos.Bl -tag -width Ds 73*b73dcc21Schristos.It Fl o 74*b73dcc21SchristosCreate an archive. 75*b73dcc21SchristosReads the list of files to store in the 76*b73dcc21Schristosarchive from standard input, and writes the archive on standard 77*b73dcc21Schristosoutput. 78*b73dcc21Schristos.Bl -tag -width Ds 79*b73dcc21Schristos.It Fl a 80*b73dcc21SchristosReset the access times on files that have been copied to the 81*b73dcc21Schristosarchive. 82*b73dcc21Schristos.It Fl A 83*b73dcc21SchristosAppend to the specified archive. 84*b73dcc21Schristos.It Fl B 85*b73dcc21SchristosSet block size of output to 5120 bytes. 86*b73dcc21Schristos.It Fl c 87*b73dcc21SchristosUse ASCII format for 88*b73dcc21Schristos.Nm 89*b73dcc21Schristosheader for portability. 90*b73dcc21Schristos.It Fl C Ar bytes 91*b73dcc21SchristosSet the block size of output to 92*b73dcc21Schristos.Ar bytes . 93*b73dcc21Schristos.It Fl F Ar archive 94*b73dcc21Schristos.It Fl O Ar archive 95*b73dcc21SchristosUse the specified file name as the archive to write to. 96*b73dcc21Schristos.It Fl H Ar format 97*b73dcc21SchristosWrite the archive in the specified format. 98*b73dcc21SchristosRecognized formats are: 99*b73dcc21Schristos.Pp 100*b73dcc21Schristos.Bl -tag -width sv4cpio -compact 101*b73dcc21Schristos.It Ar bcpio 102*b73dcc21SchristosOld binary 103*b73dcc21Schristos.Nm 104*b73dcc21Schristosformat. 105*b73dcc21Schristos.It Ar cpio 106*b73dcc21SchristosOld octal character 107*b73dcc21Schristos.Nm 108*b73dcc21Schristosformat. 109*b73dcc21Schristos.It Ar sv4cpio 110*b73dcc21SchristosSVR4 hex 111*b73dcc21Schristos.Nm 112*b73dcc21Schristosformat. 113*b73dcc21Schristos.It Ar tar 114*b73dcc21SchristosOld tar format. 115*b73dcc21Schristos.It Ar ustar 116*b73dcc21SchristosPOSIX ustar format. 117*b73dcc21Schristos.El 118*b73dcc21Schristos.It Fl L 119*b73dcc21SchristosFollow symbolic links. 120*b73dcc21Schristos.It Fl v 121*b73dcc21SchristosBe verbose about operations. 122*b73dcc21SchristosList filenames as they are written to the archive. 123*b73dcc21Schristos.It Fl z 124*b73dcc21SchristosCompress archive using 125*b73dcc21Schristos.Xr gzip 1 126*b73dcc21Schristosformat. 127*b73dcc21Schristos.It Fl Z 128*b73dcc21SchristosCompress archive using 129*b73dcc21Schristos.Xr compress 1 130*b73dcc21Schristosformat. 131*b73dcc21Schristos.El 132*b73dcc21Schristos.It Fl i 133*b73dcc21SchristosRestore files from an archive. 134*b73dcc21SchristosReads the archive file from 135*b73dcc21Schristosstandard input and extracts files matching the 136*b73dcc21Schristos.Ar patterns 137*b73dcc21Schristosthat were specified on the command line. 138*b73dcc21Schristos.Bl -tag -width Ds 139*b73dcc21Schristos.It Fl b 140*b73dcc21SchristosDo byte and word swapping after reading in data from the 141*b73dcc21Schristosarchive, for restoring archives created on systems with 142*b73dcc21Schristosa different byte order. 143*b73dcc21Schristos.It Fl B 144*b73dcc21SchristosSet the block size of the archive being read to 5120 bytes. 145*b73dcc21Schristos.It Fl c 146*b73dcc21SchristosExpect the archive headers to be in ASCII format. 147*b73dcc21Schristos.It Fl C Ar bytes 148*b73dcc21SchristosRead archive written with a block size of 149*b73dcc21Schristos.Ar bytes . 150*b73dcc21Schristos.It Fl d 151*b73dcc21SchristosCreate any intermediate directories as needed during 152*b73dcc21Schristosrestore. 153*b73dcc21Schristos.It Fl E Ar file 154*b73dcc21SchristosRead list of file name patterns to extract or list from 155*b73dcc21Schristos.Ar file . 156*b73dcc21Schristos.It Fl f 157*b73dcc21SchristosRestore all files except those matching the 158*b73dcc21Schristos.Ar patterns 159*b73dcc21Schristosgiven on the command line. 160*b73dcc21Schristos.It Fl F Ar archive 161*b73dcc21Schristos.It Fl I Ar archive 162*b73dcc21SchristosUse the specified file as the input for the archive. 163*b73dcc21Schristos.It Fl H Ar format 164*b73dcc21SchristosRead an archive of the specified format. 165*b73dcc21SchristosRecognized formats are: 166*b73dcc21Schristos.Pp 167*b73dcc21Schristos.Bl -tag -width sv4cpio -compact 168*b73dcc21Schristos.It Ar bcpio 169*b73dcc21SchristosOld binary 170*b73dcc21Schristos.Nm 171*b73dcc21Schristosformat. 172*b73dcc21Schristos.It Ar cpio 173*b73dcc21SchristosOld octal character 174*b73dcc21Schristos.Nm 175*b73dcc21Schristosformat. 176*b73dcc21Schristos.It Ar sv4cpio 177*b73dcc21SchristosSVR4 hex 178*b73dcc21Schristos.Nm 179*b73dcc21Schristosformat. 180*b73dcc21Schristos.It Ar tar 181*b73dcc21SchristosOld tar format. 182*b73dcc21Schristos.It Ar ustar 183*b73dcc21SchristosPOSIX ustar format. 184*b73dcc21Schristos.El 185*b73dcc21Schristos.It Fl m 186*b73dcc21SchristosRestore modification times on files. 187*b73dcc21Schristos.It Fl r 188*b73dcc21SchristosRename restored files interactively. 189*b73dcc21Schristos.It Fl s 190*b73dcc21SchristosSwap bytes after reading data from the archive. 191*b73dcc21Schristos.It Fl S 192*b73dcc21SchristosSwap words after reading data from the archive. 193*b73dcc21Schristos.It Fl t 194*b73dcc21SchristosOnly list the contents of the archive, no files or 195*b73dcc21Schristosdirectories will be created. 196*b73dcc21Schristos.It Fl u 197*b73dcc21SchristosOverwrite files even when the file in the archive is 198*b73dcc21Schristosolder than the one that will be overwritten. 199*b73dcc21Schristos.It Fl v 200*b73dcc21SchristosBe verbose about operations. 201*b73dcc21SchristosList filenames as they are copied in from the archive. 202*b73dcc21Schristos.It Fl z 203*b73dcc21SchristosUncompress archive using 204*b73dcc21Schristos.Xr gzip 1 205*b73dcc21Schristosformat. 206*b73dcc21Schristos.It Fl Z 207*b73dcc21SchristosUncompress archive using 208*b73dcc21Schristos.Xr compress 1 209*b73dcc21Schristosformat. 210*b73dcc21Schristos.It Fl 6 211*b73dcc21SchristosProcess old-style 212*b73dcc21Schristos.Nm 213*b73dcc21Schristosformat archives. 214*b73dcc21Schristos.El 215*b73dcc21Schristos.It Fl p 216*b73dcc21SchristosCopy files from one location to another in a single pass. 217*b73dcc21SchristosThe list of files to copy are read from standard input and 218*b73dcc21Schristoswritten out to a directory relative to the specified 219*b73dcc21Schristos.Ar directory 220*b73dcc21Schristosargument. 221*b73dcc21Schristos.Bl -tag -width Ds 222*b73dcc21Schristos.It Fl a 223*b73dcc21SchristosReset the access times on files that have been copied. 224*b73dcc21Schristos.It Fl d 225*b73dcc21SchristosCreate any intermediate directories as needed to write 226*b73dcc21Schristosthe files at the new location. 227*b73dcc21Schristos.It Fl l 228*b73dcc21SchristosWhen possible, link files rather than creating an 229*b73dcc21Schristosextra copy. 230*b73dcc21Schristos.It Fl L 231*b73dcc21SchristosFollow symbolic links. 232*b73dcc21Schristos.It Fl m 233*b73dcc21SchristosRestore modification times on files. 234*b73dcc21Schristos.It Fl u 235*b73dcc21SchristosOverwrite files even when the original file being copied is 236*b73dcc21Schristosolder than the one that will be overwritten. 237*b73dcc21Schristos.It Fl v 238*b73dcc21SchristosBe verbose about operations. 239*b73dcc21SchristosList filenames as they are copied. 240*b73dcc21Schristos.El 241*b73dcc21Schristos.El 242*b73dcc21Schristos.Sh ERRORS 243*b73dcc21Schristos.Nm 244*b73dcc21Schristoswill exit with one of the following values: 245*b73dcc21Schristos.Bl -tag -width 2n 246*b73dcc21Schristos.It 0 247*b73dcc21SchristosAll files were processed successfully. 248*b73dcc21Schristos.It 1 249*b73dcc21SchristosAn error occurred. 250*b73dcc21Schristos.El 251*b73dcc21Schristos.Pp 252*b73dcc21SchristosWhenever 253*b73dcc21Schristos.Nm 254*b73dcc21Schristoscannot create a file or a link when extracting an archive or cannot 255*b73dcc21Schristosfind a file while writing an archive, or cannot preserve the user 256*b73dcc21SchristosID, group ID, file mode, or access and modification times when the 257*b73dcc21Schristos.Fl p 258*b73dcc21Schristosoption is specified, a diagnostic message is written to standard 259*b73dcc21Schristoserror and a non-zero exit value will be returned, but processing 260*b73dcc21Schristoswill continue. 261*b73dcc21SchristosIn the case where 262*b73dcc21Schristos.Nm 263*b73dcc21Schristoscannot create a link to a file, 264*b73dcc21Schristos.Nm 265*b73dcc21Schristoswill not create a second copy of the file. 266*b73dcc21Schristos.Pp 267*b73dcc21SchristosIf the extraction of a file from an archive is prematurely terminated 268*b73dcc21Schristosby a signal or error, 269*b73dcc21Schristos.Nm 270*b73dcc21Schristosmay have only partially extracted the file the user wanted. 271*b73dcc21SchristosAdditionally, the file modes of extracted files and directories may 272*b73dcc21Schristoshave incorrect file bits, and the modification and access times may 273*b73dcc21Schristosbe wrong. 274*b73dcc21Schristos.Pp 275*b73dcc21SchristosIf the creation of an archive is prematurely terminated by a signal 276*b73dcc21Schristosor error, 277*b73dcc21Schristos.Nm 278*b73dcc21Schristosmay have only partially created the archive which may violate the 279*b73dcc21Schristosspecific archive format specification. 280*b73dcc21Schristos.Sh SEE ALSO 281*b73dcc21Schristos.Xr pax 1 , 282*b73dcc21Schristos.Xr tar 1 283*b73dcc21Schristos.Sh AUTHORS 284*b73dcc21SchristosKeith Muller at the University of California, San Diego. 285*b73dcc21Schristos.Sh BUGS 286*b73dcc21SchristosThe 287*b73dcc21Schristos.Fl s 288*b73dcc21Schristosand 289*b73dcc21Schristos.Fl S 290*b73dcc21Schristosoptions are currently not implemented. 291