How to unzip .tgz file using the terminal?

The .tgz and .tar.gz, both zip extensions are like same. To unpack them please follow the below syntax


tar options xyz.tar.gz
tar options xyz.tar.gz pattern
tar -xf xyz.tar.gz
tar -xvf xyz.tar.gz
tar -zxvf xyz.tar.gz
tar -zxvf xyz.tar.gz filename1 filename2 dirname1 dirname2

How to Extract tr.gz. filename

To extract .gz from an archive, enter:
$ tar -zxvf {filename.tar.gz}

If  the tarball name is monika.tar.gz, enter the following at a shell prompt to extract files:
$ tar -zxvf monika.tar.gz

To extract linux.doc file from monika.tar.gz tarball, enter:
$ tar -zxvf monika.tar.gz linux.doc


-z : gzip compression automatically when reading archives.
-x : Extract archives.
-v : Produce verbose output i.e. display progress and extracted file list on screen.
-f : Read the archive from the archive to the specified file.
-t : List of files in the archive.

To view a detailed table of contents (list of file and directory),
$ tar -tvf monika.tar.gz

Please follow and like us:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.