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