How to unzip .tgz file using the unix terminal?

abc.tgz and abc.tar.gz files are quite same.

Syntax to unpack .tgz and .tar.gz

$ tar options abc.tar.gz
$ tar options abc.tar.gz pattern
$ tar -xf abc.tar.gz
$ tar -xvf abc.tar.gz
$ tar -zxvf abc.tar.gz
$ tar -zxvf abc.tar.gz file1 file2 dir1 dir2

Extract tr.gz. file

To extract one or more members from an archive, enter:
$ tar -zxvf {file.tar.gz}

If the tarball name is video_backup.tar.gz, Then to extract video_backup.tar.gz file syntax should be :
$ tar -zxvf video_backup.tar.gz

To extract resume.doc file from video_backup.tar.gz tarball, enter:
$ tar -zxvf video_backup.tar.gz xxx.mp3

Where,

-z : Work on gzip compress automatically when reading archives.
-x : Extract archives.
-v : Verbose output i.e. display progress and extracted file list on screen.
-f : Read the archive from the archive to the specified file. In this example, read video_backup.tar.gz archive.
-t : List the files in the archive.

Extracting an entire archive

To extract an entire archive, specify the archive file name only, with no individual file names as arguments.
tar -zxvf video_backup.tar.gz
List files in archive

To view a detailed table of contents (list of file), enter::
$ tar -tvf video_backup.tar.gz

Please follow and like us:
0

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.