| 1 | .\" @(#)cpio.1 5.3 (Berkeley) %G% |
| 2 | .\" |
| 3 | .TH CPIO 1 "" |
| 4 | .UC 7 |
| 5 | .SH NAME |
| 6 | cpio - copy file archives in and out |
| 7 | .SH SYNOPSIS |
| 8 | cpio -o [ acBv ] |
| 9 | .br |
| 10 | cpio -i [ BcdmrtuvfsSb6 ] [ patterns ] |
| 11 | .br |
| 12 | cpio -p [ adlmruv ] directory |
| 13 | .SH DESCRIPTION |
| 14 | Cpio -o (copy out) reads the standard input to obtain a list |
| 15 | of path names and copies those files onto the standard |
| 16 | output together with path name and status information. |
| 17 | Output is padded to a 512-byte boundary. |
| 18 | .sp |
| 19 | Cpio -i (copy in) extracts files from the standard input, |
| 20 | which is assumed to be the product of a previous cpio -o. |
| 21 | Only files with names that match patterns are selected. |
| 22 | Patterns are given in the name-generating notation of sh(1). |
| 23 | In patterns, meta-characters ?, *, and [...] match the |
| 24 | slash / character. Multiple patterns may be specified and |
| 25 | if no patterns are specified, the default for patterns is * |
| 26 | (i.e., select all files). The extracted files are |
| 27 | conditionally created and copied into the current directory |
| 28 | tree based upon the options described below. The |
| 29 | permissions of the files will be those of the previous cpio |
| 30 | -o. The owner and group of the files will be that of the |
| 31 | current user unless the user is super-user, which causes |
| 32 | cpio to retain the owner and group of the files of the |
| 33 | previous cpio -o. |
| 34 | .sp |
| 35 | Cpio -p (pass) reads the standard input to obtain a list of |
| 36 | path names of files that are conditionally created and |
| 37 | copied into the destination directory tree based upon the |
| 38 | options described below. |
| 39 | .sp |
| 40 | The meanings of the available options are: |
| 41 | .IP a |
| 42 | Reset access times of input files after they have been |
| 43 | copied. |
| 44 | .IP B |
| 45 | Input/output is to be blocked 5,120 bytes to the record |
| 46 | (does not apply to the pass options; meaningful only |
| 47 | with data directed to or from /dev/rmt/??). |
| 48 | .IP d |
| 49 | Directories are to be created as needed. |
| 50 | .IP c |
| 51 | Write header information in ASCII character form for |
| 52 | portability. |
| 53 | .IP r |
| 54 | Interactively rename files. If the user types a null |
| 55 | line, the files is skipped. |
| 56 | .IP t |
| 57 | Print a table of contents of the input. No files are |
| 58 | created. |
| 59 | .IP u |
| 60 | Copy unconditionally (normally, an older file will not |
| 61 | replace a newer file with the same name). |
| 62 | .IP v |
| 63 | Verbose: causes a list of file names to be printed. |
| 64 | When used with the t option, the table of contents |
| 65 | looks like the output of an ls -l command (see ls(1)). |
| 66 | .IP l |
| 67 | Whenever possible, link files rather than copying them. |
| 68 | Usable only with the -p option. |
| 69 | .IP m |
| 70 | Retain previous file modification time. This option is |
| 71 | ineffective on directories that are being copied. |
| 72 | .IP f |
| 73 | Copy in all files except those in patterns. |
| 74 | .IP s |
| 75 | Swap bytes. Use only with the -i option. |
| 76 | .IP S |
| 77 | Swap halfwords. Use only with the -i option. |
| 78 | .IP b |
| 79 | Swap both bytes and halfwords. Use only with the -i |
| 80 | option. |
| 81 | .IP 6 |
| 82 | Process an old (i.e., UNIX System Sixth Edition format) |
| 83 | file. Only useful with -i (copy in). |
| 84 | .SH EXAMPLES |
| 85 | The first example below copies the contents of a directory |
| 86 | into an archive; the second duplicates a directory |
| 87 | hierarchy: |
| 88 | .sp |
| 89 | .in +5 |
| 90 | ls | cpio -o >/dev/rmt/0m |
| 91 | .sp |
| 92 | cd olddir |
| 93 | .br |
| 94 | find . -depth -print | cpio -pdl newdir |
| 95 | .br |
| 96 | .sp |
| 97 | .in -5 |
| 98 | The trivial case |
| 99 | .nf |
| 100 | .in +5 |
| 101 | ``find . -depth -print | cpio -oB >/dev/fmt/0m'' |
| 102 | .in -5 |
| 103 | .fi |
| 104 | can be handled more efficiently by: |
| 105 | .in +5 |
| 106 | find . -cpio /dev/rmt/0m |
| 107 | .in -5 |
| 108 | .sp |
| 109 | .SH SEE ALSO |
| 110 | ar(1), find(1), ls(1). |
| 111 | .br |
| 112 | cpio(4) in the UNIX System User Reference Manual. |
| 113 | .SH BUGS |
| 114 | Path names are restricted to 128 characters. If there are |
| 115 | too many unique linked files, the program runs out of memory |
| 116 | to keep track of them and, thereafter, linking information |
| 117 | is lost. Only the super-user can copy special files. The |
| 118 | -B option does not work with certain magnetic tape drives. |