
This will take the contents of the directory 'foo', and put them all (with the directory itself) into a file named foo.tar. To create a tarball, you use the 'c' option to tar, such as ' tar cf foo.tar foo'. So a tarball named 'ssh-1.2.32.tar.gz' will generally (but not always) create a directory named 'ssh-1.2.32', and all the files that were in it when the tarball was created.
#Unix tar compress full
It's just for neatness, so that you can have a directory full of tarballs, and know that if you untar each one you'll have a directory for each tarball as well. This is a somewhat standard approach, though not everyone (and everything) follows it. A tarball's name, say '', generally tells you that when you uncompress it, a directory named 'foo' will be created in the current directory, and all the files in 'foo' will go into that directory.

If the file spent any time on a Windows machine, or might do so, the extension '.tgz' is also common.īefore we talk about making and using tarballs, here's some common 'rules', though they are not necessarily strictly adhered to. This gives a tarball its extension, '.tar.gz', '.tar.Z' or '.tar.bz2' respectively. Because tar files, commonly called 'tarballs', are uncompressed, they are usually compressed manually with 'gzip' or 'compress' (and now people are also using 'bzip2' to compress them).

This is handy for tape drives, but is also good for things like emailing smaller files as attachments, or for FTP or HTTP transmission of larger files.

It does no compression on the files, just smashes them all together into one big file. A directory of thousands of files would be tedious to write, both for the user and for the drive! So tar will take all the files, and write them out as one large file. So to backup a directory, you would have to backup each file separately. Tape drives tend to write files one after the other.
