TAR(1) BSD TAR(1)
NAME
tar - tape archiver
SYNOPSIS
tar [ key ] [ name ... ]
DESCRIPTION
tar saves and restores multiple files on a single file (usually a
magnetic tape, but it can be any file). The key argument is a string of
characters containing at most one function letter and possibly one or
more 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.
FUNCTIONS
The function portion of the key is specified by one of the following
letters.
c Create a new tape; writing begins on the beginning of the tape
instead of after the last file. This command implies r.
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 have 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 copies. tar writes restored files
to the current directory.
t The names of the specified files are listed 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 only if they are not already
there or are there, but have been modified since they were last
archived. (Not supported by Apollo tape drivers.)
OPTIONS
The following characters may be used in addition to the letter that
selects the functions desired.
A Include Apollo-specific information; this option allows tar to
handle Domain/OS typed files.
o Suppress writing of owner and permission information from
archived directories.
p Restore files to their original modes, ignoring the present
umask(2). Restores setuid to the super-user.
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.
v Use verbose mode. Normally tar does its work silently. This
option makes tar print the name of each file it treats preceded
by the function letter. With the t function, the verbose
option gives more information about the tape entries than just
their names.
w Print the action to be taken followed by filename, then wait
for user confirmation. If you enter a word beginning with "y",
tar does the action. Any other input means "no".
f archive Use archive as the name of the archive instead of /dev/rmt?.
If the name of the file is a dash (-), tar writes to standard
output or reads from standard input as 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 factor Use factor as the blocking factor for tape records. The default
is 20. This option should be used only with raw magnetic tape
archives. tar automatically determines block size when reading
tapes (with functions x and t).
l Complain if tar cannot resolve all of the links to the files
dumped.
m Do not restore the modification times. The modification time
is set to the time of extraction.
h Force tar to 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 allows tar to work across a communications channel where
the blocking may not be maintained.
C dir perform a chdir(2) to the filename preceded by this option.
This option 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,
you might use
tar c -C /usr include -C
Previous restrictions dealing with tar's inability to properly handle
blocked archives have been lifted.
EXAMPLES
tar cbf 1 /dev/rct8 /usr/you
Writes the contents of /usr/you and all of its
subdirectories to cartridge tape.
tar xf /dev/rct8 Restores all of the files from /dev/rct8 to
the filesystem, writing them into the current
working directory.
tar cf /tarfile /usr/you/src/*.c
Bundles all files in /usr/you/src whose names
end in ``.c'' into /tarfile.
tar cfb 1 /dev/rct8 /usr/you
Won't work. Blocksize and archive file name
must be in the same order as b and f option
letters.
FILES
/dev/rmt?
/tmp/tar*
DIAGNOSTICS
Complains about bad key characters and tape read/write errors.
Complains if not enough memory is available to hold the link tables.
NOTES
Cartridge tapes must be rewound with the command mt rewind prior to using
the tar command.
BUGS
There is no way to ask for the nth occurrence of a file.
Tape errors are handled ungracefully.
The u option can be slow.
The current limit on filename length is 100 characters.
There is no way to follow symbolic links selectively.
When you extract files created with the r or u options, directory
modification times may not be set correctly.
SEE ALSO
mt(1), rbak(1), wbak(1), rwmt(1), tar(5)