When many UNIX users think of file archives, on tape or in an archive
file, they think of the tar
utility.
There are other ways to make archives and handle tapes - including
cpio
(19.9
)
,
shar
(19.2
)
,
and
dd
(20.6
)
.
This article summarizes articles about tar
-in this chapter and others.
Although tar
is a t
ape ar
chiver,
one of its common uses is
making an archive file on disk (19.5
)
.
Because tar
"pads" its archives with
NUL characters (51.3
)
,
on-disk tar
archive files can be much bigger than the size of the
individual files put together.
The file can be compressed - so you may need to
uncompress an archive (19.7
)
.
The
GNU tar
(19.6
)
can compress files while storing them.
If you make on-disk archives,
be careful with tar
's v
(verbose) flag or you could end
up with a corrupted archive that holds
more than your files (19.8
)
.
With compression, a tar
archive
can take less disk space (24.8
)
than compressing individual small files.
Because tar
keeps most of a file's
inode (1.22
)
information, it can make a
more complete copy (18.16
)
of a file or directory tree than utilities like cp
.
Yes, we do have articles about archives on tape.
Bruce Barnett's article
20.2
has enough information to make your own archive... although you might
need the details from article
20.3
,
too.
After you've made an archive, you'll probably want to restore
it - at least as a test to be sure your archive is okay.
Article
20.4
explains how.
If there isn't a tape drive on your computer, read article
20.5
about using a drive on another computer.
If that isn't enough information, read the gory details from another of our
long-time UNIX and tape experts, Chris Torek, in article
20.6
.
tar
copies
a directory tree, recursively, from top to bottom.
What if you don't want to archive everything?
You can back up just some files by
combining ls -lt
and find
(20.7
)
.
Some versions of tar
have options for
including or excluding certain files and directories (20.8
, 19.6
)
.
|
|