You’ve downloaded a file ending in .tar.gz on Linux and now you’re not quite sure what to do with it. Don’t worry—this is a very common situation, especially if you’re new to Linux.
A .tar.gz file isn’t mysterious at all. It’s simply a compressed archive, similar to a .zip or .rar file on Windows. The tricky part is that a .tar.gz archive can contain very different things: a ready-to-run program, source code that needs to be compiled, or just files that must be extracted manually.
In this guide, you’ll learn how to open a .tar.gz file, identify what’s inside it, and install the software correctly based on your situation—without breaking your system.
What Is a TAR.GZ File?
A .tar.gz file is a compressed archive created in two steps:
- Files and folders are bundled into a TAR archive (Tape Archive)
- That archive is compressed using Gzip
That’s why you’ll sometimes see .tgz instead of .tar.gz.
On Linux, this is a standard archive format, similar to ZIP on Windows—but with one important difference: TAR preserves Linux file permissions, ownership, and executable flags. This makes it ideal for distributing software.
A .tar.gz file may contain:
- A precompiled binary (ready to run)
- Source code that must be compiled
- A portable installation that runs from its folder
What you do next depends entirely on what’s inside the archive.
How to Extract a TAR.GZ File Using the Terminal
The terminal is the most universal method and works on every Linux distribution.
Extract the archive
Open a terminal in the folder containing the file and run:
tar -xzf file-name.tar.gz
What the options mean
-x→ extract-z→ decompress gzip-f→ specify the file
View contents without extracting
tar -tzf file-name.tar.gz
Extract to a specific directory
tar -xzf file-name.tar.gz -C /path/to/destination
Once extracted, you’ll get a folder containing the program files.
How to Extract a TAR.GZ File Using the Graphical Interface
If you prefer a visual approach, Linux file managers handle .tar.gz files natively.
On Ubuntu, Linux Mint, KDE, XFCE, and others:
- Right-click the
.tar.gzfile - Select Extract Here or Extract To…
You can also double-click the archive to open it in the Archive Manager and extract it from there.
The result is the same: a folder with the extracted contents.
How to Identify What’s Inside the Archive
Open the extracted folder and look for these signs:
Case 1: Precompiled Binary (Ready to Run)
Indicators:
- A file with no extension (same name as the program)
- Folders like
bin/,lib/,share/ - A
READMEorINSTALLfile
Case 2: Source Code (Needs Compilation)
Indicators:
configure,autogen.sh, orCMakeLists.txtMakefile- Folders like
src/ - Files ending in
.c,.cpp,.h
Case 3: Simple File Archive
Indicators:
- No executable
- No build system
- Just scripts, configs, or data files
The first two cases are the most common for software.
Installing Software from a Precompiled Binary
This is the easiest scenario.
Test the program
In the extracted folder, try:
./program-name
If it launches, the program works—but only from that folder.
Fixing “chrome-sandbox” errors (Electron apps)
Some Electron-based apps (Discord, Slack, VS Code) may fail with a sandbox error.
Fix it by running:
sudo chown root:root chrome-sandbox
sudo chmod 4755 chrome-sandbox
Then launch the program again.
Install the program properly
Option 1: Local installation (recommended)
mkdir -p ~/.local/share/program-name
cp -r * ~/.local/share/program-name/
mkdir -p ~/.local/bin
ln -s ~/.local/share/program-name/binary ~/.local/bin/program-name
Option 2: System-wide installation
sudo mkdir /opt/program-name
sudo cp -r * /opt/program-name/
sudo ln -s /opt/program-name/binary /usr/local/bin/program-name
Create a desktop launcher
Create a .desktop file:
nano ~/.local/share/applications/program-name.desktop
Paste:
[Desktop Entry]
Name=Program Name
Exec=/full/path/to/binary
Icon=/full/path/to/icon.png
Type=Application
Categories=Utility;
Make it executable:
chmod +x ~/.local/share/applications/program-name.desktop
update-desktop-database ~/.local/share/applications/
How to Uninstall Software Installed from TAR.GZ
Local installation
rm -rf ~/.local/share/program-name
rm ~/.local/bin/program-name
rm ~/.local/share/applications/program-name.desktop
System installation
sudo rm -rf /opt/program-name
sudo rm /usr/local/bin/program-name
rm ~/.local/share/applications/program-name.desktop
Refresh the menu cache:
update-desktop-database ~/.local/share/applications/
Compiling and Installing Software from Source Code
Install build tools
On Ubuntu/Debian:
sudo apt install build-essential
On Fedora:
sudo dnf groupinstall "Development Tools"
On Arch:
sudo pacman -S base-devel
The Classic Build Process: configure, make, make install
Step 1: Configure
./configure
Step 2: Compile
make
Step 3: Install
sudo make install
If the project uses CMake
mkdir build
cd build
cmake ..
make
sudo make install
Uninstall compiled software
sudo make uninstall
(Note: not always available.)
Modern Alternatives to TAR.GZ Files
AppImage
- Single executable file
- No installation
- Ideal for testing
Flatpak
- Sandboxed apps
- Automatic updates
- Available via Flathub
Snap
- Canonical-backed format
- Preinstalled on Ubuntu
- Easy updates
👉 If you’re a beginner, prefer Flatpak, Snap, or AppImage when available.
TAR.GZ is best when no other option exists.
Final Thoughts
A .tar.gz file isn’t dangerous or complicated—it just requires understanding what’s inside. Once you know whether you’re dealing with a binary or source code, installation becomes predictable and safe.
Learning how TAR.GZ files work gives you more control over your Linux system and helps you understand what’s happening behind the scenes—an essential step toward Linux mastery.
And if you'd like to go a step further in supporting us, you can treat us to a virtual coffee ☕️. Thank you for your support ❤️!
We do not support or promote any form of piracy, copyright infringement, or illegal use of software, video content, or digital resources.
Any mention of third-party sites, tools, or platforms is purely for informational purposes. It is the responsibility of each reader to comply with the laws in their country, as well as the terms of use of the services mentioned.
We strongly encourage the use of legal, open-source, or official solutions in a responsible manner.


Comments