Unpacking a compressed tar file

To unpack a compressed tarfile use the zcat command. This leaves the compressed .Z tarfile intact. For example:

   zcat project.tar.Z | tar xvf -

The zcat command recreates the uncompressed tarfile, which is then piped into the tar command to extract the files. Because the name of the tarfile is given as -, tar reads from standard input, the uncompressed tarfile!

You can also unpack one or more files without uncompressing the tarfile. This is useful if you want to extract one or more files from the tar archive but do not have enough diskspace to uncompress the complete tarfile. For example:

   zcat project.tar.Z | tar xvf - project/main.c

This extracts the file main.c from the tar archive project.tar.Z.


[Home] [Search] [Index] This site maintained by unixhelp@hardrock.org