tar is a file format used for archiving, as well as a Unix program to handle tar files. A tar file is often referred to as a tarball and have the extension
.tar.gz, or tgz.
I'll stick to the most basic uses of tar, for more information, see the tar manual by using:
man tar
Firstly, the tar program must use one of the following
function letters
. The most useful ones are:
c
- Creates a tarball.
r
- Appends to a tarball.
t
- Views tarball's table of contents.
u
- Update tarball if files are newer.
x
- Extracts a tarball.
There are other function letters, but the above ones are the most useful.
Next, here are some other useful command line arguments:
v
- Verbose output.
z
- Gunzip (compress) tarball.
Last, to specify the name of the tarball:
f
- Filename of the tarball to tar in and out of (name must follow the f).
Create a tarball
tar cvzf tarFilename.tar firstFile secondFile ...
Appending to a tarball
tar rvzf tarFilename.tar firstFile secondFile ...
Viewing tarball contents
tar tzf tarFilename.tar
Extracting a tarball
tar xvzf tarFilename.tar
http://en.wikipedia.org/wiki/Tar_(file_format)
http://www.cs.duke.edu/~ola/courses/programming/tar.html