1*553e3c84Swiz.\" $NetBSD: cpio.1,v 1.9 2005/09/11 23:13:03 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.\" 15b73dcc21Schristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16b73dcc21Schristos.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17b73dcc21Schristos.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18b73dcc21Schristos.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19b73dcc21Schristos.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20b73dcc21Schristos.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21b73dcc21Schristos.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22b73dcc21Schristos.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23b73dcc21Schristos.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24b73dcc21Schristos.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25b73dcc21Schristos.\" 26b73dcc21Schristos.\" OpenBSD: cpio.1,v 1.14 2000/11/10 17:52:02 aaron Exp 27b73dcc21Schristos.\" 284aff9cbaSsnj.Dd February 13, 2004 29b73dcc21Schristos.Dt CPIO 1 30b73dcc21Schristos.Os 31b73dcc21Schristos.Sh NAME 32b73dcc21Schristos.Nm cpio 33b73dcc21Schristos.Nd copy file archives in and out 34b73dcc21Schristos.Sh SYNOPSIS 35b73dcc21Schristos.Nm cpio 36b73dcc21Schristos.Fl o 37b73dcc21Schristos.Op Fl aABcLvzZ 38b73dcc21Schristos.Op Fl C Ar bytes 39b73dcc21Schristos.Op Fl F Ar archive 40b73dcc21Schristos.Op Fl H Ar format 41b73dcc21Schristos.Op Fl O Ar archive 42eb12ddd1Swiz.Ar "\*[Lt] name-list" 43eb12ddd1Swiz.Op Ar "\*[Gt] archive" 44b73dcc21Schristos.Nm cpio 45b73dcc21Schristos.Fl i 46b73dcc21Schristos.Op Fl bBcdfmrsStuvzZ6 47b73dcc21Schristos.Op Fl C Ar bytes 48b73dcc21Schristos.Op Fl E Ar file 49b73dcc21Schristos.Op Fl F Ar archive 50b73dcc21Schristos.Op Fl H Ar format 51b73dcc21Schristos.Op Fl I Ar archive 52b73dcc21Schristos.Op Ar "pattern ..." 53eb12ddd1Swiz.Op Ar "\*[Lt] archive" 54b73dcc21Schristos.Nm cpio 55b73dcc21Schristos.Fl p 56b73dcc21Schristos.Op Fl adlLmuv 57b73dcc21Schristos.Ar destination-directory 58eb12ddd1Swiz.Ar "\*[Lt] name-list" 59b73dcc21Schristos.Sh DESCRIPTION 60b73dcc21SchristosThe 61b73dcc21Schristos.Nm 62b73dcc21Schristoscommand copies files to and from a 63b73dcc21Schristos.Nm 6443c2fa4eSwizarchive. 6543c2fa4eSwizIf the archive is of the form: 6624dd1a7dSchristos.Ar [[user@]host:]file 6724dd1a7dSchristosthen the archive will be processed using 6824dd1a7dSchristos.Xr rmt 8 . 69b73dcc21Schristos.Pp 70b73dcc21SchristosThe options are as follows: 71b73dcc21Schristos.Bl -tag -width Ds 7269ea8215Schristos.It Fl o , -create 73b73dcc21SchristosCreate an archive. 74b73dcc21SchristosReads the list of files to store in the 75b73dcc21Schristosarchive from standard input, and writes the archive on standard 76b73dcc21Schristosoutput. 77b73dcc21Schristos.Bl -tag -width Ds 7869ea8215Schristos.It Fl a , -reset-access-time 79b73dcc21SchristosReset the access times on files that have been copied to the 80b73dcc21Schristosarchive. 8169ea8215Schristos.It Fl A , -append 82b73dcc21SchristosAppend to the specified archive. 83b73dcc21Schristos.It Fl B 84b73dcc21SchristosSet block size of output to 5120 bytes. 85b73dcc21Schristos.It Fl c 86b73dcc21SchristosUse ASCII format for 87b73dcc21Schristos.Nm 88b73dcc21Schristosheader for portability. 89b73dcc21Schristos.It Fl C Ar bytes 90b73dcc21SchristosSet the block size of output to 91b73dcc21Schristos.Ar bytes . 92b73dcc21Schristos.It Fl F Ar archive 93b73dcc21Schristos.It Fl O Ar archive 94b73dcc21SchristosUse the specified file name as the archive to write to. 95b73dcc21Schristos.It Fl H Ar format 96b73dcc21SchristosWrite the archive in the specified format. 97b73dcc21SchristosRecognized formats are: 98b73dcc21Schristos.Pp 99b73dcc21Schristos.Bl -tag -width sv4cpio -compact 100b73dcc21Schristos.It Ar bcpio 101b73dcc21SchristosOld binary 102b73dcc21Schristos.Nm 103b73dcc21Schristosformat. 104b73dcc21Schristos.It Ar cpio 105b73dcc21SchristosOld octal character 106b73dcc21Schristos.Nm 107b73dcc21Schristosformat. 108b73dcc21Schristos.It Ar sv4cpio 109b73dcc21SchristosSVR4 hex 110b73dcc21Schristos.Nm 111b73dcc21Schristosformat. 112b73dcc21Schristos.It Ar tar 113b73dcc21SchristosOld tar format. 114b73dcc21Schristos.It Ar ustar 115b73dcc21SchristosPOSIX ustar format. 116b73dcc21Schristos.El 117b73dcc21Schristos.It Fl L 118b73dcc21SchristosFollow symbolic links. 119b73dcc21Schristos.It Fl v 120b73dcc21SchristosBe verbose about operations. 121b73dcc21SchristosList filenames as they are written to the archive. 122b73dcc21Schristos.It Fl z 123b73dcc21SchristosCompress archive using 124b73dcc21Schristos.Xr gzip 1 125b73dcc21Schristosformat. 126b73dcc21Schristos.It Fl Z 127b73dcc21SchristosCompress archive using 128b73dcc21Schristos.Xr compress 1 129b73dcc21Schristosformat. 130b73dcc21Schristos.El 13169ea8215Schristos.It Fl i , -extract 132b73dcc21SchristosRestore files from an archive. 133b73dcc21SchristosReads the archive file from 134b73dcc21Schristosstandard input and extracts files matching the 135b73dcc21Schristos.Ar patterns 136b73dcc21Schristosthat were specified on the command line. 137b73dcc21Schristos.Bl -tag -width Ds 138b73dcc21Schristos.It Fl b 139b73dcc21SchristosDo byte and word swapping after reading in data from the 140b73dcc21Schristosarchive, for restoring archives created on systems with 141b73dcc21Schristosa different byte order. 142b73dcc21Schristos.It Fl B 143b73dcc21SchristosSet the block size of the archive being read to 5120 bytes. 144b73dcc21Schristos.It Fl c 145b73dcc21SchristosExpect the archive headers to be in ASCII format. 146b73dcc21Schristos.It Fl C Ar bytes 147b73dcc21SchristosRead archive written with a block size of 148b73dcc21Schristos.Ar bytes . 14969ea8215Schristos.It Fl d , -make-directories 150b73dcc21SchristosCreate any intermediate directories as needed during 151b73dcc21Schristosrestore. 15269ea8215Schristos.It Fl E Ar file , Fl -pattern-file Ar file 153b73dcc21SchristosRead list of file name patterns to extract or list from 154b73dcc21Schristos.Ar file . 1554aff9cbaSsnj.It Fl f , -nonmatching 156b73dcc21SchristosRestore all files except those matching the 157b73dcc21Schristos.Ar patterns 158b73dcc21Schristosgiven on the command line. 15969ea8215Schristos.It Fl F Ar archive , Fl -file Ar archive 160b73dcc21Schristos.It Fl I Ar archive 161b73dcc21SchristosUse the specified file as the input for the archive. 16269ea8215Schristos.It Fl H Ar format , Fl -format Ar format 163b73dcc21SchristosRead an archive of the specified format. 164b73dcc21SchristosRecognized formats are: 165b73dcc21Schristos.Pp 166b73dcc21Schristos.Bl -tag -width sv4cpio -compact 167b73dcc21Schristos.It Ar bcpio 168b73dcc21SchristosOld binary 169b73dcc21Schristos.Nm 170b73dcc21Schristosformat. 171b73dcc21Schristos.It Ar cpio 172b73dcc21SchristosOld octal character 173b73dcc21Schristos.Nm 174b73dcc21Schristosformat. 175b73dcc21Schristos.It Ar sv4cpio 176b73dcc21SchristosSVR4 hex 177b73dcc21Schristos.Nm 178b73dcc21Schristosformat. 179b73dcc21Schristos.It Ar tar 180b73dcc21SchristosOld tar format. 181b73dcc21Schristos.It Ar ustar 182b73dcc21SchristosPOSIX ustar format. 183b73dcc21Schristos.El 184b73dcc21Schristos.It Fl m 185b73dcc21SchristosRestore modification times on files. 18669ea8215Schristos.It Fl r , -rename 187b73dcc21SchristosRename restored files interactively. 188b73dcc21Schristos.It Fl s 189b73dcc21SchristosSwap bytes after reading data from the archive. 19069ea8215Schristos.It Fl S , -swap-halfwords 191b73dcc21SchristosSwap words after reading data from the archive. 19269ea8215Schristos.It Fl t , -list 193b73dcc21SchristosOnly list the contents of the archive, no files or 194b73dcc21Schristosdirectories will be created. 19569ea8215Schristos.It Fl u , -unconditional 196b73dcc21SchristosOverwrite files even when the file in the archive is 197b73dcc21Schristosolder than the one that will be overwritten. 19869ea8215Schristos.It Fl v , -verbose 199b73dcc21SchristosBe verbose about operations. 200b73dcc21SchristosList filenames as they are copied in from the archive. 201b73dcc21Schristos.It Fl z 202b73dcc21SchristosUncompress archive using 203b73dcc21Schristos.Xr gzip 1 204b73dcc21Schristosformat. 205b73dcc21Schristos.It Fl Z 206b73dcc21SchristosUncompress archive using 207b73dcc21Schristos.Xr compress 1 208b73dcc21Schristosformat. 209b73dcc21Schristos.It Fl 6 210b73dcc21SchristosProcess old-style 211b73dcc21Schristos.Nm 212b73dcc21Schristosformat archives. 213b73dcc21Schristos.El 21469ea8215Schristos.It Fl p , -pass-through 215b73dcc21SchristosCopy files from one location to another in a single pass. 216b73dcc21SchristosThe list of files to copy are read from standard input and 217b73dcc21Schristoswritten out to a directory relative to the specified 218b73dcc21Schristos.Ar directory 219b73dcc21Schristosargument. 220b73dcc21Schristos.Bl -tag -width Ds 221b73dcc21Schristos.It Fl a 222b73dcc21SchristosReset the access times on files that have been copied. 223b73dcc21Schristos.It Fl d 224b73dcc21SchristosCreate any intermediate directories as needed to write 225b73dcc21Schristosthe files at the new location. 22669ea8215Schristos.It Fl l , -link 227b73dcc21SchristosWhen possible, link files rather than creating an 228b73dcc21Schristosextra copy. 22969ea8215Schristos.It Fl L , -dereference 230b73dcc21SchristosFollow symbolic links. 23169ea8215Schristos.It Fl m , -preserve-modification-time 232b73dcc21SchristosRestore modification times on files. 23369ea8215Schristos.It Fl u , -unconditional 234b73dcc21SchristosOverwrite files even when the original file being copied is 235b73dcc21Schristosolder than the one that will be overwritten. 23669ea8215Schristos.It Fl v , -verbose 237b73dcc21SchristosBe verbose about operations. 238b73dcc21SchristosList filenames as they are copied. 23924dd1a7dSchristos.It Fl -force-local 240900b115eSgrantDo not interpret filenames that contain a 241900b115eSgrant.Sq \&: 242900b115eSgrantas remote files. 24324dd1a7dSchristos.It Fl -insecure 24424dd1a7dSchristosNormally 24524dd1a7dSchristos.Nm 246900b115eSgrantignores filenames that contain 247900b115eSgrant.Sq .. 248900b115eSgrantas a path component. With this option, 249900b115eSgrantfiles that contain 250900b115eSgrant.Sq .. 251900b115eSgrantcan be processed. 252b73dcc21Schristos.El 253b73dcc21Schristos.El 254*553e3c84Swiz.Sh EXIT STATUS 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