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 system that runs on desktops, laptops, servers, and other devices. When you’re ready to learn how to extract files compressed with tar, follow the guide below: About tar command: On Linux systems, including Ubuntu the tar command creates, maintains, and extracts files that are archived in tar format. “Tar” stands for tape archive. It is one of the many archiving file formats available. Syntax: 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. Options: 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 for the tar command:
Install xz-utils
Before creating or extracting tar.xz files, you must first install xz-utils. To do that, run the commands below: After installing the utility, you can begin creating .tar.xz file using the commands below; That should create a .tar.xz confidential.tar.xz file of the private content. Examples: 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: 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. Example: The command above will extract the archive file into /remote/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 option list all files in archive.tar verbosely. 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: That’s it! 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: