Extract .xz Files (Debian, Ubuntu, Rocky, Alma, RHEL)

Did you just download a file from the internet ending in .xz on your Debian, Ubuntu, Rocky, Alma, or RHEL Linux system? Any file with .xz extension is a compressed archive, and its extraction is a breeze!. This guide will show you how to open the file in few simple steps.

What is a .xz file?

A .xz file is an archive compressed using the XZ format. It offers a higher and efficient compression resulting in a smaller file easy to store, distribute and download.

Extracting .xz file on Linux

The Linux distributions mentioned come with tar pre-installed. This is a powerful archives. To extract a .xz file, follow these simple steps:

In this example we are downloading Kali Linux VM image template that’s distributed in a tar.xz format.

wget https://kali.download/cloud-images/kali-2024.2/kali-linux-2024.2-cloud-genericcloud-amd64.tar.xz

We can check the file contents using tar -tf command.

$ tar -tf kali-linux-2024.2-cloud-genericcloud-amd64.tar.xz
disk.raw

The -t flag instructs tar to give a list of the file contents.

To extract a file we use -xf flags.

tar -xf kali-linux-2024.2-cloud-genericcloud-amd64.tar.xz

Or using tar -xJf

tar -xJf  kali-linux-2024.2-cloud-genericcloud-amd64.tar.xz

Options used:

  • -x: Tar option to extract archive
  • -J: To filter the archive file through xz.
  • -f: Use to specify file to be extracted.

From the list of contents in the file earlier, the file name will be as shown then.

$ file disk.raw
disk.raw: DOS/MBR boot sector, extended partition table (last)

You can now use the raw file after extracting it using tar from .xz original compressed archive.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

Are you seeing the error -bash: ifup: command not found (or ifdown: command not found) on your Ubuntu or Debian […]

GNS3 is an open source Network Simulator that is used to emulate, configure, test and troubleshoot virtual and real networks. […]

One major benefit of Cloud computing is the ability to consume and scale compute resources as dictated by your application […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.