1.\" Copyright (c) 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.proprietary.roff% 5.\" 6.\" @(#)tar.1 6.14 (Berkeley) 07/27/92 7.\" 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 20saves and restores multiple files on a single file (usually a magnetic 21tape, but it can be any file). 22.Nm Tar Ns 's 23actions are controlled by the 24.Ar key 25argument. The 26.Ar key 27is a string of characters containing at most one function letter and possibly 28one or more function modifiers. Other arguments to 29.Nm tar 30are file or directory names specifying which files to dump or restore. 31In all cases, appearance of a directory name refers to 32the files and (recursively) subdirectories of that directory. 33.Pp 34The function portion of the key is specified by one of the following letters: 35.Bl -tag -width flag 36.It Cm r 37The named files are written on the end of the tape. The 38.Cm c 39function implies this. 40.It Cm x 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. 47.It Cm t 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. 51.It Cm u 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. 54.It Cm c 55Create a new tape; writing begins on the beginning of the tape 56instead of after the last file. This command implies 57.Cm r . 58.El 59.Pp 60The following characters may be used in addition to the letter 61which selects the function desired. 62.Bl -tag -width flag 63.It Cm o 64On output, tar normally places information specifying owner and modes 65of directories in the archive. Former versions of tar, when encountering 66this information will give error message of the form 67.Pp 68.Dl <name>/: cannot create. 69.Pp 70This modifier will suppress the directory information. 71.It Cm p 72This modifier says to restore files to their original modes, 73ignoring the present 74.Xr umask 2 . 75Setuid and sticky information 76will also be restored to the super-user. 77.It Cm 0 , ... , 9 78This modifier selects an alternate drive on which the tape is mounted. 79The default is drive 0 at 1600 bpi, which is normally 80.Pa /dev/rmt8 . 81.It Cm v 82Normally 83.Nm tar 84does its work silently. The 85.Cm v 86(verbose) option makes 87.Nm tar 88print the name of each file it treats preceded by the function 89letter. With the 90.Cm t 91function, the verbose option 92gives more information about the tape entries than just their names. 93.It Cm w 94.Nm Tar 95prints the action to be taken followed by file name, then 96wait for user confirmation. If a word beginning with 97.Ql y 98is given, the action is done. Any other input means don't do it. 99.It Cm f 100.Nm Tar 101uses the next argument as the name of the archive instead of 102/dev/rmt?. If the name of the file is 103.Ql Fl , 104tar writes to standard output or 105reads from standard input, whichever is appropriate. Thus, 106.Nm tar 107can be used as the head or tail of a filter chain. 108.Nm Tar 109can also be used to move hierarchies with the command 110.Pp 111.Bd -literal -offset indent -compact 112cd fromdir; tar cf - . | (cd todir; tar xf -) 113.Ed 114.It Cm b 115.Nm Tar 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 119.Cm f 120above). The block size is determined automatically 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 130tells 131.Nm tar 132to complain if it cannot resolve all of the links to the 133files dumped. If this is not specified, no error messages are printed. 134.It Cm m 135tells 136.Nm tar 137not to restore the modification times. The modification time 138will be the time of extraction. 139.It Cm h 140Force 141.Nm tar 142to follow symbolic links as if they were normal files or 143directories. Normally, 144.Nm tar 145does not follow symbolic links. 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 . 156.It Cm B 157Forces input and output blocking to 20 blocks per record. This option 158was added so that 159.Nm tar 160can work across a communications channel where the blocking may not 161be maintained. 162.It Cm C 163If a file name is preceded by 164.Fl C , 165then 166.Nm tar 167will perform a 168.Xr chdir 2 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 173.Pp 174.Bd -literal -offset indent -compact 175tar c -C /usr include -C / etc 176.Ed 177.El 178.Pp 179Previous restrictions dealing with 180.Nm tar Ns 's 181inability to properly handle blocked archives have been lifted. 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 , 189.Xr format 5 , 190.Xr symlink 7 191.Sh DIAGNOSTICS 192Complaints about bad key characters and tape read/write errors. 193.Pp 194Complaints if enough memory is not available to hold the link tables. 195.Sh BUGS 196There is no way to ask for the 197.Ar n Ns -th 198occurrence of a file. 199.Pp 200Tape errors are handled ungracefully. 201.Pp 202The 203.Cm u 204option can be slow. 205.Pp 206The current limit on file name length is 100 characters. 207.Pp 208There is no way selectively to follow symbolic links. 209.Pp 210When extracting tapes created with the 211.Cm r 212or 213.Cm u 214options, directory modification times may not be set correctly. 215.Sh HISTORY 216The 217.Nm tar 218command appeared in 219.At v7 . 220