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