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