Greg's Blog

helping me remember what I figure out

De-compressing Files in Linux

| Comments

One of the most frequent operations you’ll carry out when running or configuring a Linux box is to install patches, loads of them. So you’ll frequently be downloading files from the Internet and in almost all cases they will be in a compressed format. The files will usually end in .tar.gz and have been compressed using Gzip and Tar. This document will show you how to extract the content of those files.

Files ending in .gz have been compressed using Gzip (for more information, please consult the man page [man gzip]. To start the de-compression process, you need to type, from the command prompt:

gunzip <filename>.tar.gz

Using the above example this will leave you with a <filename>.tar. Right now you still can’t access the contents of the file and execute it. So you’ll need to un-tar the file or un-pack, this is done by entering the following command from the command line:

tar -xvf <filename>.tar

This extracts the contents of the file, recreates the directory structure and displays the processing. For a full listing of the switches and their functions please refer to the man pages (man tar). You can now change to the directory and execute the patch or application.

Update

Just figured out a really good way to carry out the above operations in one step:

cat <filename>.tar.gz | gunzip | tar xf -