How to use Gzip and Tar

Gzip and tar are linux files similar to Windows' zip file. A .tar file is typically an installation file that has all the necessary files for a given application. A .gz (and a .z file) file is a compressed file. Usually an install package uses both. If so, it will have a file extension something like: some_application.tar.gz.

The first thing to do is un-compress the package with gzip. Copy the .gz file into its own sibdirectory. Then execute the following command: gzip -d some_application.tar.gz. This will uncompress the package. In our example, the .gz extension will be removed. Now run the tar command to extract the files: tar xvf some_application.tar.

 

Now you are ready to install you new software. Look for a file called install or readme for further instructions. Usually there is some kind of make file. Below are a few examples.

If there is a make.in file try running:

./configure/ -prefix=/us
make all

If there is an imake file try running:

xmkmf -a
make all

If there is a make file try running:

make all

This should install your new program


To make a TAR file

tar cvfzP filaname.tar file_to_be_archived

Example:

tar cvfjP archive.tar /home/me/file

Example for archiving a folder for backup purposes. In this case a windows mounted share.

tar cvfjP MyArchive.tar /mnt/smbmount/test

This is create a file called MyArchive.tar of the folder /mnt/smbmount/test in the folder where this command was executed.

To view a list of files archived in the file execute the following command

tar tvfj MyArchive.tar | more

To Extract the above, tar xvfjP MyArchive.tar

Options:

c = Create
f = file
v = verbose
j= use bzip2 for compression (better than gzip)
P = Use absolute paths
x= Extract


NOTE: If you get the following error message: tar: This does not look like a tar archive sometimes it is because the file extension is a .tar flie. Try these things:
Try renaming the file to .tar.gz and unpack it with "tar xfz" (or, in two steps, "gunzip" and "tar xf").