1*24dd1a7dSchristos.\" $NetBSD: cpio.1,v 1.3 2002/10/16 21:47:13 christos 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*24dd1a7dSchristosarchive. If the archive is of the form: 70*24dd1a7dSchristos.Ar [[user@]host:]file 71*24dd1a7dSchristosthen the archive will be processed using 72*24dd1a7dSchristos.Xr rmt 8 . 73b73dcc21Schristos.Pp 74b73dcc21SchristosThe options are as follows: 75b73dcc21Schristos.Bl -tag -width Ds 76*24dd1a7dSchristos.It Fl o -create 77b73dcc21SchristosCreate an archive. 78b73dcc21SchristosReads the list of files to store in the 79b73dcc21Schristosarchive from standard input, and writes the archive on standard 80b73dcc21Schristosoutput. 81b73dcc21Schristos.Bl -tag -width Ds 82*24dd1a7dSchristos.It Fl a -reset-access-time 83b73dcc21SchristosReset the access times on files that have been copied to the 84b73dcc21Schristosarchive. 85*24dd1a7dSchristos.It Fl A -append 86b73dcc21SchristosAppend to the specified archive. 87b73dcc21Schristos.It Fl B 88b73dcc21SchristosSet block size of output to 5120 bytes. 89b73dcc21Schristos.It Fl c 90b73dcc21SchristosUse ASCII format for 91b73dcc21Schristos.Nm 92b73dcc21Schristosheader for portability. 93b73dcc21Schristos.It Fl C Ar bytes 94b73dcc21SchristosSet the block size of output to 95b73dcc21Schristos.Ar bytes . 96b73dcc21Schristos.It Fl F Ar archive 97b73dcc21Schristos.It Fl O Ar archive 98b73dcc21SchristosUse the specified file name as the archive to write to. 99b73dcc21Schristos.It Fl H Ar format 100b73dcc21SchristosWrite the archive in the specified format. 101b73dcc21SchristosRecognized formats are: 102b73dcc21Schristos.Pp 103b73dcc21Schristos.Bl -tag -width sv4cpio -compact 104b73dcc21Schristos.It Ar bcpio 105b73dcc21SchristosOld binary 106b73dcc21Schristos.Nm 107b73dcc21Schristosformat. 108b73dcc21Schristos.It Ar cpio 109b73dcc21SchristosOld octal character 110b73dcc21Schristos.Nm 111b73dcc21Schristosformat. 112b73dcc21Schristos.It Ar sv4cpio 113b73dcc21SchristosSVR4 hex 114b73dcc21Schristos.Nm 115b73dcc21Schristosformat. 116b73dcc21Schristos.It Ar tar 117b73dcc21SchristosOld tar format. 118b73dcc21Schristos.It Ar ustar 119b73dcc21SchristosPOSIX ustar format. 120b73dcc21Schristos.El 121b73dcc21Schristos.It Fl L 122b73dcc21SchristosFollow symbolic links. 123b73dcc21Schristos.It Fl v 124b73dcc21SchristosBe verbose about operations. 125b73dcc21SchristosList filenames as they are written to the archive. 126b73dcc21Schristos.It Fl z 127b73dcc21SchristosCompress archive using 128b73dcc21Schristos.Xr gzip 1 129b73dcc21Schristosformat. 130b73dcc21Schristos.It Fl Z 131b73dcc21SchristosCompress archive using 132b73dcc21Schristos.Xr compress 1 133b73dcc21Schristosformat. 134b73dcc21Schristos.El 135*24dd1a7dSchristos.It Fl i -extract 136b73dcc21SchristosRestore files from an archive. 137b73dcc21SchristosReads the archive file from 138b73dcc21Schristosstandard input and extracts files matching the 139b73dcc21Schristos.Ar patterns 140b73dcc21Schristosthat were specified on the command line. 141b73dcc21Schristos.Bl -tag -width Ds 142b73dcc21Schristos.It Fl b 143b73dcc21SchristosDo byte and word swapping after reading in data from the 144b73dcc21Schristosarchive, for restoring archives created on systems with 145b73dcc21Schristosa different byte order. 146b73dcc21Schristos.It Fl B 147b73dcc21SchristosSet the block size of the archive being read to 5120 bytes. 148b73dcc21Schristos.It Fl c 149b73dcc21SchristosExpect the archive headers to be in ASCII format. 150b73dcc21Schristos.It Fl C Ar bytes 151b73dcc21SchristosRead archive written with a block size of 152b73dcc21Schristos.Ar bytes . 153*24dd1a7dSchristos.It Fl d -make-directories 154b73dcc21SchristosCreate any intermediate directories as needed during 155b73dcc21Schristosrestore. 156*24dd1a7dSchristos.It Fl E Ar file Fl -pattern-file Ar file 157b73dcc21SchristosRead list of file name patterns to extract or list from 158b73dcc21Schristos.Ar file . 159*24dd1a7dSchristos.It Fl f -nonmathing 160b73dcc21SchristosRestore all files except those matching the 161b73dcc21Schristos.Ar patterns 162b73dcc21Schristosgiven on the command line. 163*24dd1a7dSchristos.It Fl F Ar archive Fl -file Ar archive 164b73dcc21Schristos.It Fl I Ar archive 165b73dcc21SchristosUse the specified file as the input for the archive. 166*24dd1a7dSchristos.It Fl H Ar format Fl -format Ar format 167b73dcc21SchristosRead an archive of the specified format. 168b73dcc21SchristosRecognized formats are: 169b73dcc21Schristos.Pp 170b73dcc21Schristos.Bl -tag -width sv4cpio -compact 171b73dcc21Schristos.It Ar bcpio 172b73dcc21SchristosOld binary 173b73dcc21Schristos.Nm 174b73dcc21Schristosformat. 175b73dcc21Schristos.It Ar cpio 176b73dcc21SchristosOld octal character 177b73dcc21Schristos.Nm 178b73dcc21Schristosformat. 179b73dcc21Schristos.It Ar sv4cpio 180b73dcc21SchristosSVR4 hex 181b73dcc21Schristos.Nm 182b73dcc21Schristosformat. 183b73dcc21Schristos.It Ar tar 184b73dcc21SchristosOld tar format. 185b73dcc21Schristos.It Ar ustar 186b73dcc21SchristosPOSIX ustar format. 187b73dcc21Schristos.El 188b73dcc21Schristos.It Fl m 189b73dcc21SchristosRestore modification times on files. 190*24dd1a7dSchristos.It Fl r -rename 191b73dcc21SchristosRename restored files interactively. 192b73dcc21Schristos.It Fl s 193b73dcc21SchristosSwap bytes after reading data from the archive. 194*24dd1a7dSchristos.It Fl S -swap-halfwords 195b73dcc21SchristosSwap words after reading data from the archive. 196*24dd1a7dSchristos.It Fl t -list 197b73dcc21SchristosOnly list the contents of the archive, no files or 198b73dcc21Schristosdirectories will be created. 199*24dd1a7dSchristos.It Fl u -unconditional 200b73dcc21SchristosOverwrite files even when the file in the archive is 201b73dcc21Schristosolder than the one that will be overwritten. 202*24dd1a7dSchristos.It Fl v -verbose 203b73dcc21SchristosBe verbose about operations. 204b73dcc21SchristosList filenames as they are copied in from the archive. 205b73dcc21Schristos.It Fl z 206b73dcc21SchristosUncompress archive using 207b73dcc21Schristos.Xr gzip 1 208b73dcc21Schristosformat. 209b73dcc21Schristos.It Fl Z 210b73dcc21SchristosUncompress archive using 211b73dcc21Schristos.Xr compress 1 212b73dcc21Schristosformat. 213b73dcc21Schristos.It Fl 6 214b73dcc21SchristosProcess old-style 215b73dcc21Schristos.Nm 216b73dcc21Schristosformat archives. 217b73dcc21Schristos.El 218*24dd1a7dSchristos.It Fl p -pass-through 219b73dcc21SchristosCopy files from one location to another in a single pass. 220b73dcc21SchristosThe list of files to copy are read from standard input and 221b73dcc21Schristoswritten out to a directory relative to the specified 222b73dcc21Schristos.Ar directory 223b73dcc21Schristosargument. 224b73dcc21Schristos.Bl -tag -width Ds 225b73dcc21Schristos.It Fl a 226b73dcc21SchristosReset the access times on files that have been copied. 227b73dcc21Schristos.It Fl d 228b73dcc21SchristosCreate any intermediate directories as needed to write 229b73dcc21Schristosthe files at the new location. 230*24dd1a7dSchristos.It Fl l -link 231b73dcc21SchristosWhen possible, link files rather than creating an 232b73dcc21Schristosextra copy. 233*24dd1a7dSchristos.It Fl L -dereference 234b73dcc21SchristosFollow symbolic links. 235*24dd1a7dSchristos.It Fl m -preserve-modification-time 236b73dcc21SchristosRestore modification times on files. 237b73dcc21Schristos.It Fl u 238b73dcc21SchristosOverwrite files even when the original file being copied is 239b73dcc21Schristosolder than the one that will be overwritten. 240b73dcc21Schristos.It Fl v 241b73dcc21SchristosBe verbose about operations. 242b73dcc21SchristosList filenames as they are copied. 243*24dd1a7dSchristos.It Fl -force-local 244*24dd1a7dSchristosDo not interpret filenames that contain a `:' as remote files. 245*24dd1a7dSchristos.It Fl -insecure 246*24dd1a7dSchristosNormally 247*24dd1a7dSchristos.Nm 248*24dd1a7dSchristosignores filenames that contain `..' as a path component. With this option, 249*24dd1a7dSchristosfiles that contain `..' can be processed. 250b73dcc21Schristos.El 251b73dcc21Schristos.El 252b73dcc21Schristos.Sh ERRORS 253b73dcc21Schristos.Nm 254b73dcc21Schristoswill exit with one of the following values: 255b73dcc21Schristos.Bl -tag -width 2n 256b73dcc21Schristos.It 0 257b73dcc21SchristosAll files were processed successfully. 258b73dcc21Schristos.It 1 259b73dcc21SchristosAn error occurred. 260b73dcc21Schristos.El 261b73dcc21Schristos.Pp 262b73dcc21SchristosWhenever 263b73dcc21Schristos.Nm 264b73dcc21Schristoscannot create a file or a link when extracting an archive or cannot 265b73dcc21Schristosfind a file while writing an archive, or cannot preserve the user 266b73dcc21SchristosID, group ID, file mode, or access and modification times when the 267b73dcc21Schristos.Fl p 268b73dcc21Schristosoption is specified, a diagnostic message is written to standard 269b73dcc21Schristoserror and a non-zero exit value will be returned, but processing 270b73dcc21Schristoswill continue. 271b73dcc21SchristosIn the case where 272b73dcc21Schristos.Nm 273b73dcc21Schristoscannot create a link to a file, 274b73dcc21Schristos.Nm 275b73dcc21Schristoswill not create a second copy of the file. 276b73dcc21Schristos.Pp 277b73dcc21SchristosIf the extraction of a file from an archive is prematurely terminated 278b73dcc21Schristosby a signal or error, 279b73dcc21Schristos.Nm 280b73dcc21Schristosmay have only partially extracted the file the user wanted. 281b73dcc21SchristosAdditionally, the file modes of extracted files and directories may 282b73dcc21Schristoshave incorrect file bits, and the modification and access times may 283b73dcc21Schristosbe wrong. 284b73dcc21Schristos.Pp 285b73dcc21SchristosIf the creation of an archive is prematurely terminated by a signal 286b73dcc21Schristosor error, 287b73dcc21Schristos.Nm 288b73dcc21Schristosmay have only partially created the archive which may violate the 289b73dcc21Schristosspecific archive format specification. 290b73dcc21Schristos.Sh SEE ALSO 291b73dcc21Schristos.Xr pax 1 , 292b73dcc21Schristos.Xr tar 1 293b73dcc21Schristos.Sh AUTHORS 294b73dcc21SchristosKeith Muller at the University of California, San Diego. 295b73dcc21Schristos.Sh BUGS 296b73dcc21SchristosThe 297b73dcc21Schristos.Fl s 298b73dcc21Schristosand 299b73dcc21Schristos.Fl S 300b73dcc21Schristosoptions are currently not implemented. 301