Extract tar.xz File In Linux Distros :Tar Command Example

Extract tar.xz File In Linux Distros :Tar Command Example

Tutorial To Extract tar.xz File In Linux Operating System

One of the frustrations for the beginner Linux users in Linux is to extract tar.xz files in Linux based operating systems. It’s really hectic when you don’t know this simple command but Linux is all about learning and doing things.

We will unzip the .tar.xz or .txz. file in this Linux tutorial post.

So, In this tutorial post, we are going to show you the method for extracting tar.xz files in Linux based operating systems. We will use tar command to unzip files like gzip, bzip2, lzip, lzma, lzop, and xz.

Xz uses the LZMA algorithm to compress files in Linux.

How To Extract tar.xz Or .txz  File In Linux Distros

The tar command or tool is pre-installed by default on all Linux distributions.

Extracting tar.xz files in Linux with tar command

Run the following command to extract or unzip tar.xz file in Linux:

tar -xf yourfilename.tar.xz

Run the following command to extract .tar.gz or .tar.bz2. file in Linux:

tar -xf  yourfilename.tar.gz

Run the following command to display the list of the files being extracted on the terminal with -v option.

tar -xvf yourfilename.tar.xz

Extract or Unzip files into the specific directory:
Run the following command to extract files into your desired directory as tar command extract files in the current directory by default.

tar -xf yourfilename.tar.xz -C /home/itsubuntu/files-folder

How To Extract Specific Files From a tar.xz File

READ More Relevant Stuff:  How To Fix The dpkg Interrupted Error In Linux? [Updated]

It’s easy to extract specific files from the archive. You need to mention the separated list of file names to be extracted after the archive name to extract specific files from tar.xz file:

tar -xf yourfilename.tar.xz filename1 filename2

Similarly, you can extract specific directories from the tar.xz file with the following command:

tar -xf yourfilename.tar.xz dir1 dir2

You can use –wildcards option allows you to extract specific file format from a tar.xz file.

For example, to extract only the files whose names end in .pdf:

tar -xf yourfilename.tar.xz --wildcards '*.pdf'

 

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

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