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