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