Please help Ukrainian armed forces! Official Fundraising

How to unpack .tar.gz archive in Linux

1 1 1 1 1 How to unpack .tar.gz archive in Linux5.00Rating 4.99 (752 Votes)

.tar.gz archives are widely used in a GNU/Linux world because of love of the community to the patent freedom and open source formats. Usually, Linux distributions utilize tar.gz format for source code compression. When you begin familiarizing yourself with the Linux world, you quickly realize you need to know how to extract .tar.gz files in Linux. Actually, tar.gz archives are a a combination of two technologies chained one after another. First, all the files are merged in what is called a Tarball - just a single file plus file names information. Then, the Tarball is compressed with the use of gzip compression algorithm. 

So, how to actually extract the .tar.gz archive?

 

tar -xvf www1.tar.gz -C /var/www/website/

 

The above command will eventually extract the file www1.tar.gz residing in current directory to the folder /var/www/website/

Let's look at the details of this command:

x command means we want to extract the archive

v switch tells tar to verbosely output file names

f means we need to specify archive name (othewise tar will look into standard input)

 

As a bonus, you can extract .tar files or even .tar.bz2 files using the same command! Just specify the correct archive name and extension.

Now, you have mastered extracting tar.gz files. Good luck!

 

 

Monday the 11th.