tar: Tape Archive
Next: dd: Image Copy
Up: Utilities
Previous: tctl: Tape Control
tar is a utility that packages a list of files (and/or directories)
into a specific tarfile, which typically ends in .tar.
tar is invoked by

where device... is the name of the tape device or tar file, and
filename... may be files and/or directories combined to produce the
tar file.
One of c, t, or x must be used.
- -c
- (create): creates a new tarfile.
- -t
- (table): lists the files on the tarfile.
- -x
- (extract): extracts the files from the tarfile.
The three other options are:
- -v
- (verbose): the size and name of each file put onto or
extracted from the tarfile is displayed.
- -o
- (ownership): on the extraction of files, do NOT extract the
original ownership of the files and directories.
This avoids the message
permission denied
when reading tar_files.
Available only on SGI machines, it is the default on SUNs.
- -f
- (device): uses the next argument as the name of the
tarfile.
It is normally in the form /dev/tape where tape
is the name of the device the file is written onto/extracted from.
For example, to write the files utilities.tex and course.tex
onto a 1/4-inch cartridge tape (device /dev/tape) on a Silicon Graphics
workstation:
tar -cvf /dev/tape utilities.tex course.tex
To read the files back onto another SGI:
tar -xvf /dev/tape
To list the contents of the file:
tar -tvf /dev/tape
NOTES:
- Not all UNIX machines create the exact same format when
writing to/reading from tape.
Prior to IRIX 5.x, Silicon Graphics uses what is called
byte ordering, or byte swapping whereas most other vendors do not.
As a result,
to read the two previous files (assuming they were written using a SUN)
on a Silicon Graphics
workstation, the following could be used (see next section for dd):
dd if=/dev/tape conv=swab,noerror,sync | tar xf -
or
tar -xvf /dev/tapens (using the no-swap driver).
To read a SGI standard tape on a Sun, dd would have to be used because
Sun does not have a ``no-swap" driver.
- Different systems may create tapes at different densities,
depending on how old their tape drives are.
If the system was purchased new in 1990 or 1991, chances are it is
using a 150 MB tape drive.
Otherwise, it is possible it is using a 60 MB tape drive.
150 MB tape drives can read tapes written by a
lower density drive, but cannot write the lower density, or write
on lower density tapes.
60 MB tapes can only read and write the lower density tapes.
- A tarfile may exist as a file in your directory.
tar only creates an archive made out of files (put a file name
on the command line instead of /dev/device).
That archive may be on disk, or in a directory.
Such a file typically ends with .tar.
- If the file name is replaced by a hyphen on the creation of the
tarfile, data is sent to the standard output.
Similarly, a hyphen on the extraction flag means the data will be
read from the standard input.
The dd example above illustrates that concept.
Next: dd: Image Copy
Up: Utilities
Previous: tctl: Tape Control
Super-User
Fri Feb 17 15:55:40 EST 1995