Compression and Archiving
Before we conclude this tutorial, there is one final subject that you should know about. This is compression/ archiving. UNIX provide several good tools for compressing and archiving your files so that you can create backups of important files or so that you can easily transfer large directory structures from one site to another. Though there are several good utilities for these purposes, two utilities have become the standard for web developers; partly because of their functionality and partly because they work cross-platform. That is, what is compressed and archived on unix can be decompressed and de-archived on Windows or Mac using such applications as WinZip or MacTar.
We'll look at the tar utility first.
The tar utility is used to archive an entire directory structure into a single file. this single file will contain all of the information in all of the directories. A tar file is easily moved from one site to another because it is a single file. when the tar file gets to the new location, you can unarchive the whole thing and the directory structure will be recreated in the new location. the tar command is executed as follows:
tar [key] [argument] [drive] [options] file_list
Tar has several options. The ones you probably will use are shown below
Let's look at an example:
"compress" and "uncompress", on the other hand, are
common utilities used
for compressing files. They are particularly useful when used in combination
with tar because once you tar an archive, you can compress the tar file which
makes it much more portable (perhaps via ftp).
Take a look at the following example in which we use compress to shrink a TAR file: