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