How to open .gz file in Linux/Unix?

You need to use gzip/gunzip program to open/extract a .gz file. It is based on DEFLATE algorithm. All the Linux/Unix comes with default gzip/gunzip program as it is used as primary compression technique in Linux/Unix based system.

How to extract a .gz file?

gunzip yourcompressfile.gz


gzip -d yourcompressfile.gz

-d refers to decompress the gzip file.

To view the latest file, type

ls -l

How to extract tar.gz file?

tar.gz files are tar files compressed with gunzip. You can use the tar program in Linux to extract a tar.gz file as following:

tar -xvzf yourfile.tar.gz

Here, x = extract, v = verbose, z = gzip, f = force

If the tar file isn’t compressed with gunzip, then you need to exclude the ‘z’ option which would be as following:

tar -xvf yourfile.tar

2 thoughts on “How to open .gz file in Linux/Unix?”

  1. I see you don’t monetize your website, don’t waste your traffic, you
    can earn additional bucks every month because you’ve got hi quality content.

    1. I am sorry, this blog is not for monetization. It is to share knowledge only. We are able to fund the blog without monetization, thank you 🙂

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.