This brief tutorial shows students and new users how to extract or unzip tar archived files compressed with xz compression ending in .tar.xz or .txz on Ubuntu 18.04 LTS.
The tar command allows you to create and extract tar archives. There are many compression algorithms used by the tar command including, gzip, bzip2, bz2, xz and more.
Tar archives compressed with xz will end with either .tar.xz or .txz.
If you’re a student or new user looking for a Linux system to learn on, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners.
Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other device.
While learning Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.…
Both Ubuntu and Windows systems allow you to be productive, easy to use, reliable and enable you to install and run thousands of programs from gaming to productivity suite software for individuals and businesses.
When you’re ready to learn how extract files compressed with tar, follow the guide below:
About tar command:
On Linux systems, including Ubuntu the tar command creates, maintain and extract files that are archived in tar format. “Tar” stands for tape archive. It is one of the many archiving file format available..
The syntax is the rule and format of how the tar command can be used… These syntax options can be reordered, but a straight format must be followed.,.
Below is an example syntax of how to use the tar command….
tar [OPTION...] [FILE]...
The command line options are switches or flags that determined how the commands are executed or controlled… they modify the behavior of the commands… they are separated by spaces and followed after the commands…
Below are some options of the tar command:
|FILE…||Replace FILE….. with the name of the archived file you wan to extract.|
|-x, –extract, –get||Use the -x or –extract or –get to extract files from an archive|
|-f, –file=ARCHIVE||Use the -f or –file to specify the use of archive file to extract|
|-v, –verbose||Use the -v or –verbose to verbosely list files being processed|
|-t, –list||Use the -t or -list to list the content of an archive|
|–help||Display a help message and exit.|
Before creating or extracting tar.xz files, you must first install xz-utils.
To do that, run the commands below:
sudo apt-get install xz-utils
After installing the utility, you can begin creating .tar.xz file using the commands below;
tar -cJf confidential.tar.xz private
That should create a .tar.xz confidential.tar.xz file of the private content.
Below are some examples of how to run and use the tar on Ubuntu Linux…
Simply run the tar command to invoke it…
To extract a tar archive file compressed with xz compression algorithm, you run the command below:
tar -xvf archive.tar.xz
The command above will extract the archive file into the current working directory. If you want to extract a tar file into another directory, simply run it with the -C option.
tar -xvf archive.tar.xz -C /remote/directory/
The command above will extract the archive file into /remote/directory directory or folder.
If you want to list the content of an archived file compressed with tar.xz, you use the -t or –list command options. This options list all files in archive.tar verbosely.
tar -tvf archive.tar.xz
That should list the content of the archive. Remember to always use the -f option to tell the command you’re working with a file archive…
When you run su with the –help option, you’ll see the help text below:
Usage: tar [OPTION...] [FILE]... GNU 'tar' saves many files together into a single tape or disk archive, and can restore individual files from the archive. Examples: tar -cf archive.tar foo bar # Create archive.tar from files foo and bar. tar -tvf archive.tar # List all files in archive.tar verbosely. tar -xf archive.tar # Extract all files from archive.tar. Local file name selection: --add-file=FILE add given FILE to the archive (useful if its name
Congratulations! You’ve learned how to use the tar command to extract archived compressed with .tar.xz or .txz on Ubuntu.
If you find any error above, please use the comment form below to report it.
You may also like the commands below: