Unzip .tgz File Using the tar Command
The tar
command is a versatile utility that is used to manipulate archives. To unzip .tar.gz
file using `tar`
command. You can extract .tgz file in following ways.
1. How to Navigate to the Directory Containing the .tgz File?
Use the cd
command to navigate to the directory where your .tgz
file is located. For example, if your file is in the Downloads folder, you would use:
cd Downloads
2. How to View the Contents of the .tgz File?
Before extracting the contents of the `.tgz`
file, you can view its contents using the following command:
tar -ztvf yourfile.tgz
Replace `yourfile.tgz`
with the name of your `.tgz`
file. This command will list the contents of the archive without extracting them
3. How to Extract the Contents of .tgz File?
To extract the content of .tar.gz
file, use the following command:
tar -xvzf <tgz file name>
Replace `tgz file name` with the name of your `.tgz`
file. This command will extract the contents of the archive into the current directory.
Hooray! You have successfully Extracted TGZ Files on the Linux Terminal with the best Unzipping TAR Command.
4. How to Extract File to a Specify Directory?
If you want to extract the contents of .tar.gz
file into a specific directory, you can use the `-C`
option followed by the path to the directory. For example, to extract .tgz file into a directory named `myfolder`
in your current directory, you would use:
tar -xzvf yourfile.tgz -C myfolder
How to Unzip .tgz File Using the Linux Terminal?
If you’re new to Linux, you might find yourself faced with files that have the `.tgz`
extension. These files are archives that have been compressed using the tar and gzip utilities. Don’t worry if this sounds complicated! In this guide, we’ll show you how to easily unzip `.tgz`
files using two different methods: the `tar`
command and the `gunzip`
command. By the end of this tutorial, you’ll be able to extract the contents of .tgz
files with confidence.
Table of Content
- Understanding .tgz or .tar.gz Files
- Quick Highlights On TGZ File Format
- How to Unzip .tgz File Using Linux Terminal?
- Method 1: Unzip .tgz File Using the tar Command
- Method 2: Unzip .tgz File Using the gunzip Command