add sed
[unix-history] / usr / src / old / cpio / cpio.1
CommitLineData
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
28has three functional modes; copy out, copy in and pass.
29.Pp
30Functional Options:
0e853b88
CL
31.Bl -tag -width 4n
32.It Fl i
33.Em Copy in .
34Extracts files from the standard input,
b5dc1377
CL
35which is assumed to be the product of a previous
36.Nm cpio
37.Fl o .
bfa647ea 38Only files with names that match patterns are selected.
b5dc1377
CL
39Patterns are given in the name-generating notation of
40.Xr sh 1 .
5325ced3 41In patterns, meta-characters
0e853b88
CL
42.Ql \&? ,
43.Ql \&* ,
5325ced3 44and
0e853b88 45.Ql [...]
b5dc1377 46match the
5325ced3 47slash
0e853b88 48.Ql \&/
5325ced3
CL
49character. Multiple patterns may be specified and
50if no patterns are specified, the default for patterns is
0e853b88 51.Ql \&*
bfa647ea
KB
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
b5dc1377
CL
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
bfa647ea 59current user unless the user is super-user, which causes
b5dc1377
CL
60.Nm cpio
61to retain the owner and group of the files of the
62previous
63.Nm cpio
64.Fl o .
0e853b88
CL
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
bfa647ea
KB
74path names of files that are conditionally created and
75copied into the destination directory tree based upon the
76options described below.
0e853b88 77.El
b5dc1377
CL
78.Pp
79Options for the above functional options:
0e853b88
CL
80.Bl -tag -width 4n
81.It Fl B
b5dc1377
CL
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/??).
0e853b88
CL
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
bfa647ea
KB
98Write header information in ASCII character form for
99portability.
0e853b88
CL
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
bfa647ea
KB
113Interactively rename files. If the user types a null
114line, the files is skipped.
0e853b88
CL
115.It Fl s
116Swap bytes. Use only with the
117.Fl i
118option.
119.It Fl t
bfa647ea
KB
120Print a table of contents of the input. No files are
121created.
0e853b88 122.It Fl u
bfa647ea
KB
123Copy unconditionally (normally, an older file will not
124replace a newer file with the same name).
0e853b88 125.It Fl v
b5dc1377 126Verbose: causes a list of file names to be printed.
bfa647ea 127When used with the t option, the table of contents
b5dc1377 128looks like the output of an
5325ced3 129.Ql ls -l
b5dc1377
CL
130command (see
131.Xr ls 1 ) .
0e853b88 132.It Fl 6
bfa647ea 133Process an old (i.e., UNIX System Sixth Edition format)
b5dc1377 134file. Only useful with
5325ced3 135.Fl i
b5dc1377 136(copy in).
0e853b88 137.El
b5dc1377 138.Sh EXAMPLES
bfa647ea
KB
139The first example below copies the contents of a directory
140into an archive; the second duplicates a directory
141hierarchy:
b5dc1377 142.Pp
0e853b88
CL
143.Bd -literal -offset indent
144ls \&| cpio -o > edev/rmt/0m
145
146cd olddir
147find \&. -depth -print \&| cpio -pdl newdir
b5dc1377 148.Pp
d012942d 149The trivial case
b5dc1377 150.Pp
0e853b88 151.Dl find \&. -depth -print \&| cpio -oB >/dev/fmt/0m
b5dc1377 152.Pp
bfa647ea 153can 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
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
bfa647ea
KB
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
b5dc1377
CL
172.Fl B
173option does not work with certain magnetic tape drives.