avoid uneeded y.tab.c recompilation
[unix-history] / usr / src / old / tar / tar.1
CommitLineData
60028cbb 1.\" @(#)tar.1 6.3 (Berkeley) %G%
d38dc912 2.\"
2240a7b2 3.TH TAR 1 ""
d38dc912
KM
4.AT 3
5.SH NAME
6tar \- tape archiver
7.SH SYNOPSIS
8.B tar
9[ key ] [ name ... ]
10.SH DESCRIPTION
11.PP
12.I Tar
e34f6ef1
KM
13saves and restores multiple files on a single file (usually a magnetic
14tape, but it can be any file).
15.IR Tar 's
16actions are controlled by the
d38dc912 17.I key
e34f6ef1 18argument. The
d38dc912 19.I key
e34f6ef1
KM
20is a string of characters containing at most one function letter and possibly
21one or more function modifiers. Other arguments to
22.I tar
23are file or directory names specifying which files to dump or restore.
d38dc912
KM
24In all cases, appearance of a directory name refers to
25the files and (recursively) subdirectories of that directory.
26.PP
e34f6ef1 27The function portion of the key is specified by one of the following letters:
d38dc912 28.TP 8
e34f6ef1
KM
29.B r
30The named files are written on the end of the tape. The
d38dc912
KM
31.B c
32function implies this.
33.TP 8
e34f6ef1
KM
34.B x
35The named files are extracted from the tape. If the named file
36matches a directory whose contents had been written onto the tape, this
37directory is (recursively) extracted. The owner, modification time, and mode
38are restored (if possible). If no file argument is given, the entire content
39of the tape is extracted. Note that if multiple entries specifying the same
40file are on the tape, the last one overwrites all earlier.
d38dc912 41.TP 8
e34f6ef1
KM
42.B t
43The names of the specified files are listed each time they occur on
44the tape. If no file argument is given, all of the names on the tape
45are listed.
d38dc912 46.TP 8
e34f6ef1
KM
47.B u
48The named files are added to the tape if either they are not
49already there or have been modified since last put on the tape.
d38dc912 50.TP 8
e34f6ef1
KM
51.B c
52Create a new tape; writing begins on the beginning of the tape
53instead of after the last file. This command implies
54.BR r .
52f3cf84
JL
55.PP
56The following characters may be used in addition to the letter
57which selects the function desired.
58.TP 10
e34f6ef1 59.B o
d38dc912 60On output, tar normally places information specifying owner and modes
e34f6ef1 61of directories in the archive. Former versions of tar, when encountering
d38dc912
KM
62this information will give error message of the form
63.br
64 "<name>/: cannot create".
65.br
52f3cf84
JL
66This modifier will suppress the directory information.
67.TP 10
e34f6ef1 68.B p
52f3cf84 69This modifier says to restore files to their original modes,
e34f6ef1
KM
70ignoring the present
71.IR umask (2).
72Setuid and sticky information
d38dc912 73will also be restored to the super-user.
d38dc912 74.TP 10
e34f6ef1
KM
75.B 0, ..., 9
76This modifier selects an alternate drive on which the tape is mounted.
77The default is drive 0 at 1600 bpi, which is normally /dev/rmt8.
d38dc912 78.TP 10
e34f6ef1 79.B v
d38dc912
KM
80Normally
81.I tar
e34f6ef1 82does its work silently. The
d38dc912 83.B v
e34f6ef1
KM
84(verbose) option make
85.I tar
86type the name of each file it treats preceded by the function
87letter. With the
d38dc912 88.B t
e34f6ef1
KM
89function, the verbose option
90gives more information about the tape entries than just their names.
d38dc912 91.TP 10
e34f6ef1
KM
92.B w
93.I Tar
94prints the action to be taken followed by file name, then
d38dc912 95wait for user confirmation. If a word beginning with `y'
e34f6ef1 96is given, the action is done. Any other input means don't do it.
d38dc912
KM
97.TP 10
98.B f
e34f6ef1
KM
99.I Tar
100uses the next argument as the name of the archive instead of
101/dev/rmt?. If the name of the file is `\-', tar writes to standard output or
102reads from standard input, whichever is appropriate. Thus,
d38dc912 103.I tar
e34f6ef1 104can be used as the head or tail of a filter chain.
d38dc912
KM
105.I Tar
106can also be used to move hierarchies with the command
107.ce 1
108cd fromdir; tar cf - . | (cd todir; tar xf -)
109.TP 10
110.B b
e34f6ef1
KM
111.I Tar
112uses the next argument as the blocking factor for tape records. The
113default is 20 (the maximum). This option should only be used with raw magnetic
114tape archives (See
d38dc912 115.B f
e34f6ef1
KM
116above). The block size is determined automatically
117when reading tapes (key letters `x' and `t').
d38dc912
KM
118.TP 10
119.B l
e34f6ef1 120tells
d38dc912 121.I tar
e34f6ef1
KM
122to complain if it cannot resolve all of the links to the
123files dumped. If this is not specified, no error messages are printed.
d38dc912
KM
124.TP 10
125.B m
e34f6ef1 126tells
d38dc912 127.I tar
e34f6ef1 128not to restore the modification times. The modification time
d38dc912 129will be the time of extraction.
e34f6ef1
KM
130.TP 10
131.B h
132Force
133.I tar
134to follow symbolic links as if they were normal files or
135directories. Normally,
136.I tar
137does not follow symbolic links.
138.TP 10
139.B B
140Forces input and output blocking to 20 blocks per record. This option
141was added so that
142.I tar
143can work across a communications channel where the blocking may not
144be maintained.
60028cbb
KM
145.TP 10
146.B C
e34f6ef1
KM
147If a file name is preceded by
148.BR \-C ,
149then
150.I tar
151will perform a
152.IR chdir (2)
153to that file name. This allows multiple directories not
154related by a close common parent to be archived using short
155relative path names. For example, to archive files from /usr/include
156and from /etc, one might use
157.ti +0.5i
158tar c -C /usr include -C / etc
d38dc912
KM
159.PP
160Previous restrictions dealing with
161.IR tar 's
e34f6ef1 162inability to properly handle blocked archives have been lifted.
d38dc912
KM
163.PP
164.SH FILES
165/dev/rmt?
166.br
167/tmp/tar*
168.SH DIAGNOSTICS
169Complaints about bad key characters and tape read/write errors.
170.br
e34f6ef1 171Complaints if enough memory is not available to hold the link tables.
d38dc912
KM
172.SH BUGS
173There is no way to ask for the
174.IR n -th
175occurrence of a file.
176.br
177Tape errors are handled ungracefully.
178.br
e34f6ef1 179The
d38dc912
KM
180.B u
181option can be slow.
182.br
e34f6ef1
KM
183The current limit on file name length is 100 characters.
184.br
185There is no way to selectively follow symbolic links.