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