1.\" Copyright (c) 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)cpio.1 5.4 (Berkeley) 06/11/90 7.\" 8.Dd 9.\" @(#)cpio.1 5.3 (Berkeley) 3/29/88 10.\" 11.Dt CPIO 1 12.Os BSD 4.4 13.Sh NAME 14.Nm cpio 15.Nd copy file archives in and out 16.Sh SYNOPSIS 17.Nm cpio 18.Fl o 19.Op Fl acBv 20.br 21.Nm cpio 22.Fl i 23.Op Fl BcdmrtuvfsSb6 24.Op Ar patterns 25.br 26.Nm cpio 27.Fl p 28.Op Fl adlmruv 29.Ar directory 30.Sh DESCRIPTION 31.Nm Cpio 32has three functional modes; copy out, copy in and pass. 33.Pp 34Functional Options: 35.Tp Fl o 36Copy out \- reads the standard input to obtain a list 37of path names and copies those files onto the standard 38output together with path name and status information. 39Output is padded to a 512-byte boundary. 40.Pp 41.Tp Fl i 42Copy in \- extracts files from the standard input, 43which is assumed to be the product of a previous 44.Nm cpio 45.Fl o . 46Only files with names that match patterns are selected. 47Patterns are given in the name-generating notation of 48.Xr sh 1 . 49In patterns, meta-characters ?, *, and 50.Op ... 51match the 52slash / character. Multiple patterns may be specified and 53if no patterns are specified, the default for patterns is * 54(i.e., select all files). The extracted files are 55conditionally created and copied into the current directory 56tree based upon the options described below. The 57permissions of the files will be those of the previous 58.Nm cpio 59.Fl o . 60The owner and group of the files will be that of the 61current user unless the user is super-user, which causes 62.Nm cpio 63to retain the owner and group of the files of the 64previous 65.Nm cpio 66.Fl o . 67.Pp 68.Tp Fl p 69Pass \- reads the standard input to obtain a list of 70path names of files that are conditionally created and 71copied into the destination directory tree based upon the 72options described below. 73.Tp 74.Pp 75Options for the above functional options: 76.Tp Fl a 77Reset access times of input files after they have been 78copied. 79.Tp Fl B 80Input/output is to be blocked 5,120 bytes to the record 81(does not apply to the pass options; meaningful only 82with data directed to or from 83.Pa /dev/rmt/??). 84.Tp Fl d 85Directories are to be created as needed. 86.Tp Fl c 87Write header information in ASCII character form for 88portability. 89.Tp Fl r 90Interactively rename files. If the user types a null 91line, the files is skipped. 92.Tp Fl t 93Print a table of contents of the input. No files are 94created. 95.Tp Fl u 96Copy unconditionally (normally, an older file will not 97replace a newer file with the same name). 98.Tp Fl v 99Verbose: causes a list of file names to be printed. 100When used with the t option, the table of contents 101looks like the output of an 102.Li ls -l 103command (see 104.Xr ls 1 ) . 105.Tp Fl l 106Whenever possible, link files rather than copying them. 107Usable only with the 108.Fl p 109option. 110.Tp Fl m 111Retain previous file modification time. This option is 112ineffective on directories that are being copied. 113.Tp Fl f 114Copy in all files except those in patterns. 115.Tp Fl s 116Swap bytes. Use only with the 117.Fl i 118option. 119.Tp Fl S 120Swap halfwords. Use only with the 121.Fl i 122option. 123.Tp Fl b 124halfwords. Use only with the 125.Fl i 126option. 127.Tp Fl 6 128Process an old (i.e., UNIX System Sixth Edition format) 129file. Only useful with 130.FL i 131(copy in). 132.Tp 133.Sh EXAMPLES 134The first example below copies the contents of a directory 135into an archive; the second duplicates a directory 136hierarchy: 137.Pp 138.Dl ls cpio -o >/dev/rmt/0m 139.Pp 140.Dl cd olddir 141.Dl find . -depth -print cpio -pdl newdir 142.Pp 143The trivial case 144.Pp 145.Dl find . -depth -print cpio -oB >/dev/fmt/0m 146.Pp 147can be handled more efficiently by: 148.Pp 149.Dl find . -cpio /dev/rmt/0m 150.Pp 151.Sh SEE ALSO 152.Xr ar 1 , 153.Xr find 1 , 154.Xr ls 1 . 155.Xr cpio 4 156in the UNIX System User Reference Manual. 157.Sh HISTORY 158The 159.Nm cpio 160command appeared in System V AT&T UNIX. This program is derived 161from the System V AT&T sources which were contributed to the public 162domain by AT&T. 163.Sh BUGS 164Path names are restricted to 128 characters. If there are 165too many unique linked files, the program runs out of memory 166to keep track of them and, thereafter, linking information 167is lost. Only the super-user can copy special files. The 168.Fl B 169option does not work with certain magnetic tape drives. 170