TAR(1) — User’s Manual — Commands
NAME
tar − tape archiver
SYNOPSIS
tar − txruc [ ovfblmh ] [ tapefile ] [ blocksize ] file1 file2 ...
DESCRIPTION
Tar saves and restores multiple files on a single file (usually a magnetic tape, but it can be any file). Tar’s actions are controlled by the key, a string of characters containing exactly one function letter from the set rxtuc followed by one or more optional function modifiers. Other arguments to tar are file or directory names specifying which files to dump or restore. In all cases, appearance of a directory name refers to the files and (recursively) subdirectories of that directory.
FUNCTION LETTERS
r Write the named files on the end of the tape. The c function implies this.
x Extract the named files from the tape. If the named file matches a directory whose contents had been written onto the tape, this directory is (recursively) extracted. The owner, modification time, and mode are restored (if possible). If no file argument is given, the entire content of the tape is extracted. Note that if multiple entries specifying the same file are on the tape, the last one overwrites all earlier versions.
t List the names of the specified files each time they occur on the tape. If no file argument is given, all of the names on the tape are listed.
u Add the named files to the tape if they are not there or have been modified since last put on the tape.
c Create a new tape. If the c function is used, writing begins on the beginning of the tape instead of after the last file. This function implies r.
p Restore the named files to their original modes, ignoring the present umask(2). Setuid and sticky information are also restored if you are the super-user.
FUNCTION MODIFIERS
0,...,9 Select an alternate drive on which the tape is mounted. The default is drive 0 at 1600 bpi, which is normally /dev/rmt8.
o Suppress information specifying owner and modes of directories which tar normally places in the archive. Such information makes former versions of tar generate an error message like:
‘<name>/: cannot create’
when they encounter it.
v Normally tar does its work silently; the v (verbose) option displays the name of each file tar treats preceded by the function letter. When used with the t function, v displays the tape entries in a form similar to ls −l.
w Wait for user confirmation before taking the specified action. If you use w, tar displays the action to be taken followed by the file name, and then waits for a ‘y’ response to proceed. No action is taken on the named file if you type anything other than a line beginning with ‘y’.
f Use the next argument as the name of the archive instead of /dev/rmt8. If the name of the file is ‘−’, tar writes to standard output or reads from standard input, whichever is appropriate. Thus, tar can be used as the head or tail of a filter chain. Tar can also be used to move hierarchies with the command
cd fromdir; tar cf − . | (cd todir; tar xf −)
b Use the next argument as the blocking factor for tape records. The default blocking factor is 20 blocks. The block size is determined automatically when reading tapes (key letters x and t). This determination of the blocking factor may be fooled when reading from a pipe or a socket (see the B key letter below). The maximum blocking factor is determined only by the amount of memory available to the program at the time it runs. Larger blocking factors result in better throughput, longer blocks on nine-track tapes, and better media utilization.
l Display error messages if all links to dumped files cannot be resolved. If l is not used, no error messages are printed.
m Do not restore modification times of extracted files. The modification time will be the time of extraction.
h Follow symbolic links as if they were normal files or directories. Normally, tar does not follow symbolic links.
B Force input and output blocking to 20 blocks per record. This option was added so that tar can work across a communications channel where the blocking may not be maintained.
i Ignore directory checksum errors.
If a file name is preceded by −C, tar will perform a chdir(2) to that file name. This allows multiple directories not related by a close common parent to be archived using short relative path names. For example, to archive files from /usr/include and from /etc, one might use
tar c −C /usr include −C /etc
Previous restrictions dealing with tar’s inability to properly handle blocked archives have been lifted.
FILES
/dev/rmt?
/tmp/tar∗
SEE ALSO
tar(5), cpio(1), dump(8), restor(8)
DIAGNOSTICS
Complains about bad key characters and tape read/write errors.
Complains if enough memory is not available to hold the link tables.
BUGS
There is no way to ask for the n-th occurrence of a file.
Tape errors are handled ungracefully.
The u option can be slow.
The current limit on file name length is 100 characters.
There is no way to selectively follow symbolic links.
Sun System Release 0.3 — 13 April 1983