Currently Being Moderated

How do I unpack a compressed tar file ( files ending in *.tar.Z or *.tar.gz )?

VERSION 1

Created on: Mar 14, 2009 5:34 PM by Claudia - Last Modified:  Mar 14, 2009 5:37 PM by Claudia

When downloading files, you will find that they are normally of the form filename.tar.Z or filename.tar.gz These files have been archived then compressed or zipped.

 


Uncompressing a .Z file

Files ending in  .Z  have been compressed using the  compress  command.  Compressed files can be  restored  to  their  original  form using the uncompress command.

 

Type:

uncompress filename.tar.Z

 

This replaces filename.tar.Z with filename.tar

 


Unzipping a .gz file

Files ending in .gz have been compressed using the  gzip command.  Zipped files can be  restored  to  their  original  form using the gunzip command.

 

Type:

         gunzip filename.tar.gz 

 

This replaces filename.tar.gz with filename.tar

 


Extracting tar files

The tar command is used for packing several files or even a whole directory into a single tarfile.

 

To unpack a tar file, type:

         tar xvf filename.tar 

 

Note: Always move to an empty directory before unpacking a tarfile.
When you unpack a tarfile its contents are written to the current directory. Any file or directory with the same name as the contents of the tarfile will be overwritten!

 


A quick method

Alternatively, you can unpack a compressed/zipped tarfile using the  zcat or gzcat command. (gzcat is a local alias for  the GNU zcat command). This leaves the compressed .Z or .gz tarfile intact.

 

For example:

        zcat filename.tar.Z  | tar xvf - 
or
       gzcat filename.tar.gz | tar xvf -

The zcat command recreates the uncompressed tarfile, which is then piped into the tar command to extract the files.

Average User Rating
(0 ratings)
My Rating:




There are no comments on this document

More Like This

  • Retrieving data ...

More by Claudia