xref: /csrg-svn/old/cpio/cpio.1 (revision 60654)
143082Scael.\" Copyright (c) 1990 The Regents of the University of California.
243082Scael.\" All rights reserved.
333835Sbostic.\"
443082Scael.\" %sccs.include.redist.man%
543082Scael.\"
6*60654Smckusick.\"     @(#)cpio.1	5.7 (Berkeley) 05/31/93
743082Scael.\"
844952Scael.Dd
943082Scael.Dt CPIO 1
1047399Scael.Os
1143082Scael.Sh NAME
1243082Scael.Nm cpio
1343082Scael.Nd copy file archives in and out
1443082Scael.Sh SYNOPSIS
1543082Scael.Nm cpio
1643082Scael.Fl i
1743082Scael.Op Fl BcdmrtuvfsSb6
1843082Scael.Op Ar patterns
1943082Scael.Nm cpio
2047399Scael.Fl o
2147399Scael.Op Fl acBv
2247399Scael.Nm cpio
2343082Scael.Fl p
2443082Scael.Op Fl adlmruv
2543082Scael.Ar directory
2643082Scael.Sh DESCRIPTION
2743082Scael.Nm Cpio
2843082Scaelhas three functional modes; copy out, copy in and pass.
2943082Scael.Pp
3043082ScaelFunctional Options:
3147399Scael.Bl -tag -width 4n
3247399Scael.It Fl i
3347399Scael.Em Copy in .
3447399ScaelExtracts files from the standard input,
3543082Scaelwhich is assumed to be the product of a previous
3643082Scael.Nm cpio
3743082Scael.Fl o .
3833834SbosticOnly files with names that match patterns are selected.
3943082ScaelPatterns are given in the name-generating notation of
4043082Scael.Xr sh 1 .
4144952ScaelIn patterns, meta-characters
4247399Scael.Ql \&? ,
4347399Scael.Ql \&* ,
4444952Scaeland
4547399Scael.Ql [...]
4643082Scaelmatch the
4744952Scaelslash
4847399Scael.Ql \&/
4944952Scaelcharacter.  Multiple patterns may be specified and
5044952Scaelif no patterns are specified, the default for patterns is
5147399Scael.Ql \&*
5233834Sbostic(i.e., select all files).  The extracted files are
5333834Sbosticconditionally created and copied into the current directory
5433834Sbostictree based upon the options described below.  The
5543082Scaelpermissions of the files will be those of the previous
5643082Scael.Nm cpio
5743082Scael.Fl o .
5843082ScaelThe owner and group of the files will be that of the
59*60654Smckusickcurrent user unless the user is the super-user, which causes
6043082Scael.Nm cpio
6143082Scaelto retain the owner and group of the files of the
6243082Scaelprevious
6343082Scael.Nm cpio
6443082Scael.Fl o .
6547399Scael.It Fl o
6647399Scael.Em Copy out .
6747399ScaelReads the standard input to obtain a list
6847399Scaelof path names and copies those files onto the standard
6947399Scaeloutput together with path name and status information.
7047399ScaelOutput is padded to a 512-byte boundary.
7147399Scael.It Fl p
7247399Scael.Em Pass.
7347399ScaelReads the standard input to obtain a list of
7433834Sbosticpath names of files that are conditionally created and
7533834Sbosticcopied into the destination directory tree based upon the
7633834Sbosticoptions described below.
7747399Scael.El
7843082Scael.Pp
79*60654SmckusickOptions for the above functional option:
8047399Scael.Bl -tag -width 4n
8147399Scael.It Fl B
8243082ScaelInput/output is to be blocked 5,120 bytes to the record
8343082Scael(does not apply to the pass options; meaningful only
8443082Scaelwith data directed to or from
85*60654Smckusick.Pa /dev/rmt0).
8647399Scael.It Fl S
8747399ScaelSwap halfwords.  Use only with the
8847399Scael.Fl i
8947399Scaeloption.
9047399Scael.It Fl a
9147399ScaelReset access times of input files after they have been
9247399Scaelcopied.
9347399Scael.It Fl b
94*60654SmckusickSwap halfwords.  Use only with the
9547399Scael.Fl i
9647399Scaeloption.
9747399Scael.It Fl c
9833834SbosticWrite header information in ASCII character form for
9933834Sbosticportability.
10047399Scael.It Fl d
10147399ScaelDirectories are to be created as needed.
10247399Scael.It Fl f
10347399ScaelCopy in all files except those in patterns.
10447399Scael.It Fl l
10547399ScaelWhenever possible, link files rather than copying them.
10647399ScaelUsable only with the
10747399Scael.Fl p
10847399Scaeloption.
10947399Scael.It Fl m
11047399ScaelRetain previous file modification time.  This option is
11147399Scaelineffective on directories that are being copied.
11247399Scael.It Fl r
11333834SbosticInteractively rename files.  If the user types a null
114*60654Smckusickline, the file is skipped.
11547399Scael.It Fl s
11647399ScaelSwap bytes.  Use only with the
11747399Scael.Fl i
11847399Scaeloption.
11947399Scael.It Fl t
12033834SbosticPrint a table of contents of the input.  No files are
12133834Sbosticcreated.
12247399Scael.It Fl u
12333834SbosticCopy unconditionally (normally, an older file will not
12433834Sbosticreplace a newer file with the same name).
12547399Scael.It Fl v
12643082ScaelVerbose: causes a list of file names to be printed.
127*60654SmckusickWhen used with the
128*60654Smckusick.Fl t
129*60654Smckusickoption, the table of contents
13043082Scaellooks like the output of an
13144952Scael.Ql ls -l
13243082Scaelcommand (see
13343082Scael.Xr ls 1 ) .
13447399Scael.It Fl 6
13533834SbosticProcess an old (i.e., UNIX System Sixth Edition format)
13643082Scaelfile.  Only useful with
13744952Scael.Fl i
13843082Scael(copy in).
13947399Scael.El
14043082Scael.Sh EXAMPLES
14133834SbosticThe first example below copies the contents of a directory
14233834Sbosticinto an archive; the second duplicates a directory
14333834Sbostichierarchy:
14443082Scael.Pp
14547399Scael.Bd -literal -offset indent
146*60654Smckusickls  \&| cpio -o > /dev/rmt0
14747399Scael
14847399Scaelcd olddir
14947399Scaelfind \&. -depth -print \&|  cpio -pdl newdir
15043082Scael.Pp
15133835SbosticThe trivial case
15243082Scael.Pp
153*60654Smckusick.Dl find \&. -depth -print \&|  cpio -oB >/dev/rmt0
15443082Scael.Pp
15533834Sbosticcan be handled more efficiently by:
15643082Scael.Pp
157*60654Smckusick.Dl find \&. -cpio /dev/rmt0
15843082Scael.Sh SEE ALSO
15943082Scael.Xr ar 1 ,
16043082Scael.Xr find 1 ,
16144952Scael.Xr ls 1 ,
16243082Scael.Xr cpio 4
16343082Scael.Sh HISTORY
16443082ScaelThe
16543082Scael.Nm cpio
16643082Scaelcommand appeared in System V AT&T UNIX.  This program is derived
16743082Scaelfrom the System V AT&T sources which were contributed to the public
16843082Scaeldomain by AT&T.
16943082Scael.Sh BUGS
17033834SbosticPath names are restricted to 128 characters.  If there are
17133834Sbostictoo many unique linked files, the program runs out of memory
17233834Sbosticto keep track of them and, thereafter, linking information
17333834Sbosticis lost.  Only the super-user can copy special files.  The
17443082Scael.Fl B
17543082Scaeloption does not work with certain magnetic tape drives.
176