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