Step Guide to Unzip .tgz File in Linux – Linux Tutorial

By | April 1, 2022

In this tutorial, we will introduce how to unzip .tgz file in linux system. Command tar will be used in terminal.

Unzip .tgz file to current directory

For example, there is a .tgz file (filename.tgz) in the current directory.

tar -zxvf filename.tgz

Run this command, you will see filename.tgz is unpacked to current directory.

Unzip .tgz file to a specific directory

Here is an example:

tar -zxvf filename.tgz -C /tmp/data

We can use -C target directory to unpack a .tgz file to it. In this example, filename.tgz will be unzipped into /temp/data.

Leave a Reply