147845Sbostic.\" Copyright (c) 1990 The Regents of the University of California. 247845Sbostic.\" All rights reserved. 319680Smckusick.\" 4*50829Scael.\" %sccs.include.proprietary.roff% 543745Scael.\" 6*50829Scael.\" @(#)tar.1 6.11 (Berkeley) 08/09/91 747845Sbostic.\" 8*50829Scael.Dd 9*50829Scael.Dt TAR 1 10*50829Scael.Os ATT 7th 11*50829Scael.Sh NAME 12*50829Scael.Nm tar 13*50829Scael.Nd tape archiver 14*50829Scael.Sh SYNOPSIS 15*50829Scael.Nm tar 16*50829Scael.Op Ar key 17*50829Scael.Op Ar name Ar ... 18*50829Scael.Sh DESCRIPTION 19*50829Scael.Nm Tar 2019681Smckusicksaves and restores multiple files on a single file (usually a magnetic 2119681Smckusicktape, but it can be any file). 22*50829Scael.Nm Tar Ns 's 2319681Smckusickactions are controlled by the 24*50829Scael.Ar key 2519681Smckusickargument. The 26*50829Scael.Ar key 2719681Smckusickis a string of characters containing at most one function letter and possibly 2819681Smckusickone or more function modifiers. Other arguments to 29*50829Scael.Nm tar 3019681Smckusickare file or directory names specifying which files to dump or restore. 3119680SmckusickIn all cases, appearance of a directory name refers to 3219680Smckusickthe files and (recursively) subdirectories of that directory. 33*50829Scael.Pp 3419681SmckusickThe function portion of the key is specified by one of the following letters: 35*50829Scael.Bl -tag -width flag 36*50829Scael.It Cm r 3719681SmckusickThe named files are written on the end of the tape. The 38*50829Scael.Cm c 3919680Smckusickfunction implies this. 40*50829Scael.It Cm x 4119681SmckusickThe named files are extracted from the tape. If the named file 4219681Smckusickmatches a directory whose contents had been written onto the tape, this 4319681Smckusickdirectory is (recursively) extracted. The owner, modification time, and mode 4419681Smckusickare restored (if possible). If no file argument is given, the entire content 4519681Smckusickof the tape is extracted. Note that if multiple entries specifying the same 4619681Smckusickfile are on the tape, the last one overwrites all earlier. 47*50829Scael.It Cm t 4819681SmckusickThe names of the specified files are listed each time they occur on 4919681Smckusickthe tape. If no file argument is given, all of the names on the tape 5019681Smckusickare listed. 51*50829Scael.It Cm u 5219681SmckusickThe named files are added to the tape if either they are not 5319681Smckusickalready there or have been modified since last put on the tape. 54*50829Scael.It Cm c 5519681SmckusickCreate a new tape; writing begins on the beginning of the tape 5619681Smckusickinstead of after the last file. This command implies 57*50829Scael.Cm r . 58*50829Scael.El 59*50829Scael.Pp 6022933SlepreauThe following characters may be used in addition to the letter 6122933Slepreauwhich selects the function desired. 62*50829Scael.Bl -tag -width flag 63*50829Scael.It Cm o 6419680SmckusickOn output, tar normally places information specifying owner and modes 6519681Smckusickof directories in the archive. Former versions of tar, when encountering 6619680Smckusickthis information will give error message of the form 67*50829Scael.Pp 68*50829Scael.Dl <name>/: cannot create. 69*50829Scael.Pp 7022933SlepreauThis modifier will suppress the directory information. 71*50829Scael.It Cm p 7222933SlepreauThis modifier says to restore files to their original modes, 7319681Smckusickignoring the present 74*50829Scael.Xr umask 2 . 7519681SmckusickSetuid and sticky information 7619680Smckusickwill also be restored to the super-user. 77*50829Scael.It Cm 0 , ... , 9 7819681SmckusickThis modifier selects an alternate drive on which the tape is mounted. 79*50829ScaelThe default is drive 0 at 1600 bpi, which is normally 80*50829Scael.Pa /dev/rmt8 . 81*50829Scael.It Cm v 8219680SmckusickNormally 83*50829Scael.Nm tar 8419681Smckusickdoes its work silently. The 85*50829Scael.Cm v 8627995Sanne(verbose) option makes 87*50829Scael.Nm tar 8827965Slepreauprint the name of each file it treats preceded by the function 8919681Smckusickletter. With the 90*50829Scael.Cm t 9119681Smckusickfunction, the verbose option 9219681Smckusickgives more information about the tape entries than just their names. 93*50829Scael.It Cm w 94*50829Scael.Nm Tar 9519681Smckusickprints the action to be taken followed by file name, then 96*50829Scaelwait for user confirmation. If a word beginning with 97*50829Scael.Ql y 9819681Smckusickis given, the action is done. Any other input means don't do it. 99*50829Scael.It Cm f 100*50829Scael.Nm Tar 10119681Smckusickuses the next argument as the name of the archive instead of 102*50829Scael/dev/rmt?. If the name of the file is 103*50829Scael.Ql Fl , 104*50829Scaeltar writes to standard output or 10519681Smckusickreads from standard input, whichever is appropriate. Thus, 106*50829Scael.Nm tar 10719681Smckusickcan be used as the head or tail of a filter chain. 108*50829Scael.Nm Tar 10919680Smckusickcan also be used to move hierarchies with the command 110*50829Scael.Pp 111*50829Scael.Bd -literal -offset indent -compact 11219680Smckusickcd fromdir; tar cf - . | (cd todir; tar xf -) 113*50829Scael.Ed 114*50829Scael.It Cm b 115*50829Scael.Nm Tar 11619681Smckusickuses the next argument as the blocking factor for tape records. The 11719681Smckusickdefault is 20 (the maximum). This option should only be used with raw magnetic 11819681Smckusicktape archives (See 119*50829Scael.Cm f 12019681Smckusickabove). The block size is determined automatically 121*50829Scaelwhen reading tapes (key letters 122*50829Scael.Cm x 123*50829Scaeland 124*50829Scael.Cm t ) . 125*50829Scael.It Cm s 126*50829Scaeltells 127*50829Scael.Nm tar 128*50829Scaelto strip off any leading slashes from pathnames. 129*50829Scael.It Cm l 13019681Smckusicktells 131*50829Scael.Nm tar 13219681Smckusickto complain if it cannot resolve all of the links to the 13327965Slepreaufiles dumped. If this is not specified, no error messages are printed. 134*50829Scael.It Cm m 13519681Smckusicktells 136*50829Scael.Nm tar 13719681Smckusicknot to restore the modification times. The modification time 13819680Smckusickwill be the time of extraction. 139*50829Scael.It Cm h 14019681SmckusickForce 141*50829Scael.Nm tar 14219681Smckusickto follow symbolic links as if they were normal files or 14319681Smckusickdirectories. Normally, 144*50829Scael.Nm tar 14519681Smckusickdoes not follow symbolic links. 146*50829Scael.It Cm B 14719681SmckusickForces input and output blocking to 20 blocks per record. This option 14819681Smckusickwas added so that 149*50829Scael.Nm tar 15019681Smckusickcan work across a communications channel where the blocking may not 15119681Smckusickbe maintained. 152*50829Scael.It Cm C 15319681SmckusickIf a file name is preceded by 154*50829Scael.Fl C , 15519681Smckusickthen 156*50829Scael.Nm tar 15719681Smckusickwill perform a 158*50829Scael.Xr chdir 2 15919681Smckusickto that file name. This allows multiple directories not 16019681Smckusickrelated by a close common parent to be archived using short 16119681Smckusickrelative path names. For example, to archive files from /usr/include 16219681Smckusickand from /etc, one might use 163*50829Scael.Pp 164*50829Scael.Bd -literal -offset indent -compact 16519681Smckusicktar c -C /usr include -C / etc 166*50829Scael.Ed 167*50829Scael.El 168*50829Scael.Pp 16919680SmckusickPrevious restrictions dealing with 170*50829Scael.Nm tar Ns 's 17119681Smckusickinability to properly handle blocked archives have been lifted. 172*50829Scael.Sh FILES 173*50829Scael.Bl -tag -width /dev/rmtxxx -compact 174*50829Scael.It Pa /dev/rmt? 175*50829Scael.It Pa /tmp/tar* 176*50829Scael.El 177*50829Scael.Sh SEE ALSO 178*50829Scael.Xr tar 5 , 179*50829Scael.Xr format 5 180*50829Scael.Sh DIAGNOSTICS 18119680SmckusickComplaints about bad key characters and tape read/write errors. 182*50829Scael.Pp 18319681SmckusickComplaints if enough memory is not available to hold the link tables. 184*50829Scael.Sh BUGS 18519680SmckusickThere is no way to ask for the 186*50829Scael.Ar n Ns -th 18719680Smckusickoccurrence of a file. 188*50829Scael.Pp 18919680SmckusickTape errors are handled ungracefully. 190*50829Scael.Pp 19119681SmckusickThe 192*50829Scael.Cm u 19319680Smckusickoption can be slow. 194*50829Scael.Pp 19519681SmckusickThe current limit on file name length is 100 characters. 196*50829Scael.Pp 19727965SlepreauThere is no way selectively to follow symbolic links. 198*50829Scael.Pp 19927965SlepreauWhen extracting tapes created with the 200*50829Scael.Cm r 20127965Slepreauor 202*50829Scael.Cm u 20327965Slepreauoptions, directory modification times may not be set correctly. 204*50829Scael.Sh HISTORY 205*50829ScaelThe 206*50829Scael.Nm tar 207*50829Scaelcommand appeared in 208*50829Scael.At v7 . 209