Published: July 22, 2026
Read: 8 min
In: Technology & Development

TL;DR

To extract tar files in Linux, you can try the following methods:

  • To extract tar files using the command line interface:
    • For a .tar.xz file, run the tar -xf archive_name.tar.xz command for extraction.
    • When dealing with a .tar file, employ tar -xf archive_name.tar to open.
    • To extract a .tar.gz file, utilize tar -xzf archive_name.tar.gz effectively.
    • For unpacking a .tar.bz2 file, execute tar -xjf archive_name.tar.bz2.
  • With GUIs like Archive Manager, just click and choose where to extract, making it easy to open files without typing commands.

Extracting TAR files in Linux can sometimes lead to errors such as “File Not Found”, “Permission Denied”, “Not a TAR Archive”, “Archive Is Corrupt”, and issues with gzip format. These problems are often fixable by checking locations, permissions or ensuring correct commands and file integrity.

Extracting tar files in Linux can seem tricky, especially if you’re new to using the command line or graphical interfaces. But don’t worry, there’s a simple way to do it, and this post is here to guide you through each step. Whether you’re dealing with a .tar.xz, .tar, .tar.gz, or .tar.bz2 file, I’ll show you how to open them easily using tools you already have on your Linux system. Plus, I’ll share some tips on fixing common issues you might run into along the way. So, let’s dive in and make working with tar files in Linux a breeze

What Are Tar Files in Linux?

Tar files in Linux, commonly known as tarballs, are archives used primarily for distributing or backing up multiple files and directories as a single file. The name “tar” stands for Tape Archive, reflecting its origins as a method for writing data to sequential I/O devices like tape drives. A tar file typically has a .tar extension, indicating that it packages multiple files together without compression.

However, tar files can be compressed using additional tools such as gzip or bzip2, resulting in extensions like .tar.gz or .tar.bz2. These compressed tar files are smaller in size, making them more convenient for storage and transfer. The tar command provides functionality for creating, extracting, and managing these archives, making it a fundamental tool for file handling in Unix-like operating systems.

How to Extract Tar Files in Linux?

To extract tar files in Linux, you can use the tar command followed by specific options. For example, to extract the contents of a .tar file, you would use tar -xvf filename.tar, where -x stands for extract, -v for verbose (showing the progress), and -f specifies the filename. This command extracts the files into the current directory. If you’re dealing with a compressed file, such as .tar.gz or .tar.bz2, you would add the -z or -j option respectively, before the -f option, like tar -xzvf filename.tar.gz or tar -xjvf filename.tar.bz2.

2 Ways to Extract Tar Files in Linux

Extracting different types of tar files on Linux can be accomplished using a variety of methods. Below, I’ll detail how to extract .tar.xz, .tar, .tar.gz, and .tar.bz2 files using both command-line tools and graphical user interfaces (GUIs), ensuring you have the knowledge to handle these common archive formats efficiently.

1. Extract Tar files using the Command Line Interface (CLI)

The tar command is versatile and can handle various compression formats through different flags. Here’s how to use it for each file type:

1. Extracting .tar.xz Files

  1. Launch the Terminal by pressing Ctrl+Alt+T.
opening terminal 5
  1. Navigate to the file’s directory by running the command:

<strong>cd /path/to/directory</strong>

Replace /path/to/directory with the directory name you want to compress.

navigating to directory
  1. Run the following command to extract the file: 

<strong>tar -xf archive_name.tar.xz</strong>

Remember to replace archive_name.tar.xz with your file’s actual name.

extracting tar xz files
  1. Once the command runs successfully, use the ls command to see the extracted files.
verifying extraction of tar xz file

2. Extracting .tar Files

  1. Access the Terminal and navigate to the folder holding your .tar file.
  2. Execute the following command and press Enter:

<strong>tar -xf archive_name.tar</strong>

Replace archive_name.tar with the name of your file.

extracting tar files
  1. Use ls to view the contents now extracted from the archive.
verifying extraction of tar file

3. Extracting .tar.gz Files

  1. Open the Terminal and go to the directory containing your .tar.gz file.
  2. Type the following command:

<strong>tar -xzf archive_name.tar.gz</strong>

Ensure you replace archive_name.tar.gz with the actual file name.

extracting tar gz files
  1. After extraction, use ls to check the extracted contents.
verifying extraction of tar gz file

4. Extracting .tar.bz2 Files

  1. Access your command window and change to the directory containing your .tar.bz2 file.
  2. Enter the following command: