get rid of unmatched quote so ANSI cpp doesn't barf
[unix-history] / usr / src / old / tar / tar.1
CommitLineData
ee36a77d
KB
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
d38dc912 3.\"
3f4f3ab0 4.\" %sccs.include.proprietary.roff%
ee36a77d 5.\"
0d17b9a2 6.\" @(#)tar.1 6.14 (Berkeley) %G%
daacd5f0 7.\"
3f4f3ab0
CL
8.Dd
9.Dt TAR 1
10.Os ATT 7th
11.Sh NAME
12.Nm tar
13.Nd tape archiver
14.Sh SYNOPSIS
15.Nm tar
16.Op Ar key
17.Op Ar name Ar ...
18.Sh DESCRIPTION
19.Nm Tar
e34f6ef1
KM
20saves and restores multiple files on a single file (usually a magnetic
21tape, but it can be any file).
3f4f3ab0 22.Nm Tar Ns 's
e34f6ef1 23actions are controlled by the
3f4f3ab0 24.Ar key
e34f6ef1 25argument. The
3f4f3ab0 26.Ar key
e34f6ef1
KM
27is a string of characters containing at most one function letter and possibly
28one or more function modifiers. Other arguments to
3f4f3ab0 29.Nm tar
e34f6ef1 30are file or directory names specifying which files to dump or restore.
d38dc912
KM
31In all cases, appearance of a directory name refers to
32the files and (recursively) subdirectories of that directory.
3f4f3ab0 33.Pp
e34f6ef1 34The function portion of the key is specified by one of the following letters:
3f4f3ab0
CL
35.Bl -tag -width flag
36.It Cm r
e34f6ef1 37The named files are written on the end of the tape. The
3f4f3ab0 38.Cm c
d38dc912 39function implies this.
3f4f3ab0 40.It Cm x
e34f6ef1
KM
41The named files are extracted from the tape. If the named file
42matches a directory whose contents had been written onto the tape, this
43directory is (recursively) extracted. The owner, modification time, and mode
44are restored (if possible). If no file argument is given, the entire content
45of the tape is extracted. Note that if multiple entries specifying the same
46file are on the tape, the last one overwrites all earlier.
3f4f3ab0 47.It Cm t
e34f6ef1
KM
48The names of the specified files are listed each time they occur on
49the tape. If no file argument is given, all of the names on the tape
50are listed.
3f4f3ab0 51.It Cm u
e34f6ef1
KM
52The named files are added to the tape if either they are not
53already there or have been modified since last put on the tape.
3f4f3ab0 54.It Cm c
e34f6ef1
KM
55Create a new tape; writing begins on the beginning of the tape
56instead of after the last file. This command implies
3f4f3ab0
CL
57.Cm r .
58.El
59.Pp
52f3cf84
JL
60The following characters may be used in addition to the letter
61which selects the function desired.
3f4f3ab0
CL
62.Bl -tag -width flag
63.It Cm o
d38dc912 64On output, tar normally places information specifying owner and modes
e34f6ef1 65of directories in the archive. Former versions of tar, when encountering
d38dc912 66this information will give error message of the form
3f4f3ab0
CL
67.Pp
68.Dl <name>/: cannot create.
69.Pp
52f3cf84 70This modifier will suppress the directory information.
3f4f3ab0 71.It Cm p
52f3cf84 72This modifier says to restore files to their original modes,
e34f6ef1 73ignoring the present
3f4f3ab0 74.Xr umask 2 .
e34f6ef1 75Setuid and sticky information
d38dc912 76will also be restored to the super-user.
3f4f3ab0 77.It Cm 0 , ... , 9
e34f6ef1 78This modifier selects an alternate drive on which the tape is mounted.
3f4f3ab0
CL
79The default is drive 0 at 1600 bpi, which is normally
80.Pa /dev/rmt8 .
81.It Cm v
d38dc912 82Normally
3f4f3ab0 83.Nm tar
e34f6ef1 84does its work silently. The
3f4f3ab0 85.Cm v
056978a3 86(verbose) option makes
3f4f3ab0 87.Nm tar
bc638801 88print the name of each file it treats preceded by the function
e34f6ef1 89letter. With the
3f4f3ab0 90.Cm t
e34f6ef1
KM
91function, the verbose option
92gives more information about the tape entries than just their names.
3f4f3ab0
CL
93.It Cm w
94.Nm Tar
e34f6ef1 95prints the action to be taken followed by file name, then
3f4f3ab0
CL
96wait for user confirmation. If a word beginning with
97.Ql y
e34f6ef1 98is given, the action is done. Any other input means don't do it.
3f4f3ab0
CL
99.It Cm f
100.Nm Tar
e34f6ef1 101uses the next argument as the name of the archive instead of
3f4f3ab0
CL
102/dev/rmt?. If the name of the file is
103.Ql Fl ,
104tar writes to standard output or
e34f6ef1 105reads from standard input, whichever is appropriate. Thus,
3f4f3ab0 106.Nm tar
e34f6ef1 107can be used as the head or tail of a filter chain.
3f4f3ab0 108.Nm Tar
d38dc912 109can also be used to move hierarchies with the command
3f4f3ab0
CL
110.Pp
111.Bd -literal -offset indent -compact
d38dc912 112cd fromdir; tar cf - . | (cd todir; tar xf -)
3f4f3ab0
CL
113.Ed
114.It Cm b
115.Nm Tar
e34f6ef1
KM
116uses the next argument as the blocking factor for tape records. The
117default is 20 (the maximum). This option should only be used with raw magnetic
118tape archives (See
3f4f3ab0 119.Cm f
e34f6ef1 120above). The block size is determined automatically
3f4f3ab0
CL
121when reading tapes (key letters
122.Cm x
123and
124.Cm t ) .
125.It Cm s
126tells
127.Nm tar
128to strip off any leading slashes from pathnames.
129.It Cm l
e34f6ef1 130tells
3f4f3ab0 131.Nm tar
e34f6ef1 132to complain if it cannot resolve all of the links to the
bc638801 133files dumped. If this is not specified, no error messages are printed.
3f4f3ab0 134.It Cm m
e34f6ef1 135tells
3f4f3ab0 136.Nm tar
e34f6ef1 137not to restore the modification times. The modification time
d38dc912 138will be the time of extraction.
3f4f3ab0 139.It Cm h
e34f6ef1 140Force
3f4f3ab0 141.Nm tar
e34f6ef1
KM
142to follow symbolic links as if they were normal files or
143directories. Normally,
3f4f3ab0 144.Nm tar
e34f6ef1 145does not follow symbolic links.
8a090e78
EA
146.It Cm H
147Force
148.Nm tar
149to follow symbolic links on the command line only as if they were normal
150files or directories. Normally,
151.Nm tar
152does not follow symbolic links. Note that
153.Fl h
154supercedes
155.Fl H .
3f4f3ab0 156.It Cm B
e34f6ef1
KM
157Forces input and output blocking to 20 blocks per record. This option
158was added so that
3f4f3ab0 159.Nm tar
e34f6ef1
KM
160can work across a communications channel where the blocking may not
161be maintained.
3f4f3ab0 162.It Cm C
e34f6ef1 163If a file name is preceded by
3f4f3ab0 164.Fl C ,
e34f6ef1 165then
3f4f3ab0 166.Nm tar
e34f6ef1 167will perform a
3f4f3ab0 168.Xr chdir 2
e34f6ef1
KM
169to that file name. This allows multiple directories not
170related by a close common parent to be archived using short
171relative path names. For example, to archive files from /usr/include
172and from /etc, one might use
3f4f3ab0
CL
173.Pp
174.Bd -literal -offset indent -compact
e34f6ef1 175tar c -C /usr include -C / etc
3f4f3ab0
CL
176.Ed
177.El
178.Pp
d38dc912 179Previous restrictions dealing with
3f4f3ab0 180.Nm tar Ns 's
e34f6ef1 181inability to properly handle blocked archives have been lifted.
3f4f3ab0
CL
182.Sh FILES
183.Bl -tag -width /dev/rmtxxx -compact
184.It Pa /dev/rmt?
185.It Pa /tmp/tar*
186.El
187.Sh SEE ALSO
188.Xr tar 5 ,
0d17b9a2
KB
189.Xr format 5 ,
190.Xr symlink 7
3f4f3ab0 191.Sh DIAGNOSTICS
d38dc912 192Complaints about bad key characters and tape read/write errors.
3f4f3ab0 193.Pp
e34f6ef1 194Complaints if enough memory is not available to hold the link tables.
3f4f3ab0 195.Sh BUGS
d38dc912 196There is no way to ask for the
3f4f3ab0 197.Ar n Ns -th
d38dc912 198occurrence of a file.
3f4f3ab0 199.Pp
d38dc912 200Tape errors are handled ungracefully.
3f4f3ab0 201.Pp
e34f6ef1 202The
3f4f3ab0 203.Cm u
d38dc912 204option can be slow.
3f4f3ab0 205.Pp
e34f6ef1 206The current limit on file name length is 100 characters.
3f4f3ab0 207.Pp
bc638801 208There is no way selectively to follow symbolic links.
3f4f3ab0 209.Pp
bc638801 210When extracting tapes created with the
3f4f3ab0 211.Cm r
bc638801 212or
3f4f3ab0 213.Cm u
bc638801 214options, directory modification times may not be set correctly.
3f4f3ab0
CL
215.Sh HISTORY
216The
217.Nm tar
218command appeared in
219.At v7 .