How to Unzip a GZ File in Linux

Techwalla may earn compensation through affiliate links in this story.

GZ files are archive files compressed with the "gzip" program, similar to zip files. These archive files contain one or more files, compressed into a smaller file size for faster download times from the Internet. Source code and other software program files for Linux are often distributed in .gz or .tar.gz format. Unzip a GZ file using the "gunzip" command or a .tar.gz file using the "tar" command in a Linux terminal.

Advertisement

Step 1

Open a terminal window by clicking "Applications," "Accessories" or "System Tools" and "Terminal."

Step 2

Navigate to the directory containing the GZ file by typing "cd" into the "Terminal" window, pressing "Space," typing the name of the directory and pressing "Enter." For example, navigate to the "Downloads" directory by typing "cd Downloads" into the "Terminal" window and pressing "Enter."

Advertisement

Step 3

Unzip a .GZ file by typing "gunzip" into the "Terminal" window, pressing "Space," typing the name of the .gz file and pressing "Enter." For example, unzip a file named "example.gz" by typing "gunzip example.gz" into the "Terminal" window and pressing "Enter."

Step 4

Unzip a .tar.gz file by typing "tar -zxvf" into the "Terminal" window, pressing "Space," typing the name of the .tar.gz file and pressing "Enter." For example, unzip a file named "example.tar.gz" by typing "tar -zxvf example.tar.gz" into the "Terminal" window and pressing "Enter."

Advertisement

references