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.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

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

Recent Post

Leave a Comment

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

Related Post

The web browser is the key arsenal that we use to browse the internet. If you want to access information […]

In this guide,we will look at how you can install Java 11 on Oracle Linux 8. Java is a widely […]

The adoption of Containers and microservice architectures has been amazing and speedy in the past few years. Docker is widely […]

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.