xref: /csrg-svn/old/tar/tar.1 (revision 55729)
147845Sbostic.\" Copyright (c) 1990 The Regents of the University of California.
247845Sbostic.\" All rights reserved.
319680Smckusick.\"
450829Scael.\" %sccs.include.proprietary.roff%
543745Scael.\"
6*55729Sbostic.\"	@(#)tar.1	6.14 (Berkeley) 07/27/92
747845Sbostic.\"
850829Scael.Dd
950829Scael.Dt TAR 1
1050829Scael.Os ATT 7th
1150829Scael.Sh NAME
1250829Scael.Nm tar
1350829Scael.Nd tape archiver
1450829Scael.Sh SYNOPSIS
1550829Scael.Nm tar
1650829Scael.Op Ar key
1750829Scael.Op Ar name Ar ...
1850829Scael.Sh DESCRIPTION
1950829Scael.Nm Tar
2019681Smckusicksaves and restores multiple files on a single file (usually a magnetic
2119681Smckusicktape, but it can be any file).
2250829Scael.Nm Tar Ns 's
2319681Smckusickactions are controlled by the
2450829Scael.Ar key
2519681Smckusickargument.  The
2650829Scael.Ar key
2719681Smckusickis a string of characters containing at most one function letter and possibly
2819681Smckusickone or more function modifiers.  Other arguments to
2950829Scael.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.
3350829Scael.Pp
3419681SmckusickThe function portion of the key is specified by one of the following letters:
3550829Scael.Bl -tag -width flag
3650829Scael.It Cm r
3719681SmckusickThe named files are written on the end of the tape.  The
3850829Scael.Cm c
3919680Smckusickfunction implies this.
4050829Scael.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.
4750829Scael.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.
5150829Scael.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.
5450829Scael.It Cm c
5519681SmckusickCreate a new tape; writing begins on the beginning of the tape
5619681Smckusickinstead of after the last file.  This command implies
5750829Scael.Cm r .
5850829Scael.El
5950829Scael.Pp
6022933SlepreauThe following characters may be used in addition to the letter
6122933Slepreauwhich selects the function desired.
6250829Scael.Bl -tag -width flag
6350829Scael.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
6750829Scael.Pp
6850829Scael.Dl <name>/: cannot create.
6950829Scael.Pp
7022933SlepreauThis modifier will suppress the directory information.
7150829Scael.It Cm p
7222933SlepreauThis modifier says to restore files to their original modes,
7319681Smckusickignoring the present
7450829Scael.Xr umask 2 .
7519681SmckusickSetuid and sticky information
7619680Smckusickwill also be restored to the super-user.
7750829Scael.It Cm 0 , ... , 9
7819681SmckusickThis modifier selects an alternate drive on which the tape is mounted.
7950829ScaelThe default is drive 0 at 1600 bpi, which is normally
8050829Scael.Pa /dev/rmt8 .
8150829Scael.It Cm v
8219680SmckusickNormally
8350829Scael.Nm tar
8419681Smckusickdoes its work silently.  The
8550829Scael.Cm v
8627995Sanne(verbose) option makes
8750829Scael.Nm tar
8827965Slepreauprint the name of each file it treats preceded by the function
8919681Smckusickletter.  With the
9050829Scael.Cm t
9119681Smckusickfunction, the verbose option
9219681Smckusickgives more information about the tape entries than just their names.
9350829Scael.It Cm w
9450829Scael.Nm Tar
9519681Smckusickprints the action to be taken followed by file name, then
9650829Scaelwait for user confirmation. If a word beginning with
9750829Scael.Ql y
9819681Smckusickis given, the action is done. Any other input means don't do it.
9950829Scael.It Cm f
10050829Scael.Nm Tar
10119681Smckusickuses the next argument as the name of the archive instead of
10250829Scael/dev/rmt?. If the name of the file is
10350829Scael.Ql Fl ,
10450829Scaeltar writes to standard output or
10519681Smckusickreads from standard input, whichever is appropriate. Thus,
10650829Scael.Nm tar
10719681Smckusickcan be used as the head or tail of a filter chain.
10850829Scael.Nm Tar
10919680Smckusickcan also be used to move hierarchies with the command
11050829Scael.Pp
11150829Scael.Bd -literal -offset indent -compact
11219680Smckusickcd fromdir; tar cf - . | (cd todir; tar xf -)
11350829Scael.Ed
11450829Scael.It Cm b
11550829Scael.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
11950829Scael.Cm f
12019681Smckusickabove).  The block size is determined automatically
12150829Scaelwhen reading tapes (key letters
12250829Scael.Cm x
12350829Scaeland
12450829Scael.Cm t ) .
12550829Scael.It Cm s
12650829Scaeltells
12750829Scael.Nm tar
12850829Scaelto strip off any leading slashes from pathnames.
12950829Scael.It Cm l
13019681Smckusicktells
13150829Scael.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.
13450829Scael.It Cm m
13519681Smckusicktells
13650829Scael.Nm tar
13719681Smckusicknot to restore the modification times.  The modification time
13819680Smckusickwill be the time of extraction.
13950829Scael.It Cm h
14019681SmckusickForce
14150829Scael.Nm tar
14219681Smckusickto follow symbolic links as if they were normal files or
14319681Smckusickdirectories.  Normally,
14450829Scael.Nm tar
14519681Smckusickdoes not follow symbolic links.
14653770Selan.It Cm H
14753770SelanForce
14853770Selan.Nm tar
14953770Selanto follow symbolic links on the command line only as if they were normal
15053770Selanfiles or directories.  Normally,
15153770Selan.Nm tar
15253770Selandoes not follow symbolic links.  Note that
15353770Selan.Fl h
15453770Selansupercedes
15553770Selan.Fl H .
15650829Scael.It Cm B
15719681SmckusickForces input and output blocking to 20 blocks per record.  This option
15819681Smckusickwas added so that
15950829Scael.Nm tar
16019681Smckusickcan work across a communications channel where the blocking may not
16119681Smckusickbe maintained.
16250829Scael.It Cm C
16319681SmckusickIf a file name is preceded by
16450829Scael.Fl C ,
16519681Smckusickthen
16650829Scael.Nm tar
16719681Smckusickwill perform a
16850829Scael.Xr chdir 2
16919681Smckusickto that file name.  This allows multiple directories not
17019681Smckusickrelated by a close common parent to be archived using short
17119681Smckusickrelative path names.  For example, to archive files from /usr/include
17219681Smckusickand from /etc, one might use
17350829Scael.Pp
17450829Scael.Bd -literal -offset indent -compact
17519681Smckusicktar c -C /usr include -C / etc
17650829Scael.Ed
17750829Scael.El
17850829Scael.Pp
17919680SmckusickPrevious restrictions dealing with
18050829Scael.Nm tar Ns 's
18119681Smckusickinability to properly handle blocked archives have been lifted.
18250829Scael.Sh FILES
18350829Scael.Bl -tag -width /dev/rmtxxx -compact
18450829Scael.It Pa /dev/rmt?
18550829Scael.It Pa /tmp/tar*
18650829Scael.El
18750829Scael.Sh SEE ALSO
18850829Scael.Xr tar 5 ,
189*55729Sbostic.Xr format 5 ,
190*55729Sbostic.Xr symlink 7
19150829Scael.Sh DIAGNOSTICS
19219680SmckusickComplaints about bad key characters and tape read/write errors.
19350829Scael.Pp
19419681SmckusickComplaints if enough memory is not available to hold the link tables.
19550829Scael.Sh BUGS
19619680SmckusickThere is no way to ask for the
19750829Scael.Ar n Ns -th
19819680Smckusickoccurrence of a file.
19950829Scael.Pp
20019680SmckusickTape errors are handled ungracefully.
20150829Scael.Pp
20219681SmckusickThe
20350829Scael.Cm u
20419680Smckusickoption can be slow.
20550829Scael.Pp
20619681SmckusickThe current limit on file name length is 100 characters.
20750829Scael.Pp
20827965SlepreauThere is no way selectively to follow symbolic links.
20950829Scael.Pp
21027965SlepreauWhen extracting tapes created with the
21150829Scael.Cm r
21227965Slepreauor
21350829Scael.Cm u
21427965Slepreauoptions, directory modification times may not be set correctly.
21550829Scael.Sh HISTORY
21650829ScaelThe
21750829Scael.Nm tar
21850829Scaelcommand appeared in
21950829Scael.At v7 .
220