How to decompress .tar.xz files under Linux

巴扎黑
Release: 2017-08-17 10:18:36
Original
2135 people have browsed it

Preface

I believe many people are unfamiliar with xz compression, but xz is a compression tool that comes with most Linux by default. The xz format is smaller than 7z.

I recently encountered this compression format when downloading a source code package. I would like to take this opportunity to share the xz compression and decompression method.

Installation

If the system does not have the xz command, you need to install it. The installation method is very simple. Under centos, run directly:

yum install xz
Copy after login

You can also use the source package to install:

First download the tool source code package http://tukaani.org/xz/

After downloading, unzip and enter the directory to run configure to generate the makefile file and specify the installation directory with -prefix

./configure --prefix=/usr/local/xz
Copy after login

After completion, you will find that the makefile file is generated in the directory

make && sudo make install
Copy after login

The -s here indicates a soft connection

ln -s /usr/local/xz/bin/xz  /bin/xz
Copy after login

xz –help will see the help information about the xz tool, indicating that the installation is successful

Create xz compressed file

xz -z 待压缩文件名
Copy after login

-k Keep the original file;

-0 to -9 adjust the compression ratio. If not set, the default compression level is 6;

Decompress the xz compressed file

xz -d 待解压文件
Copy after login

-k Keep the original file;

The file decompressed in this way is a packaged file in tar format , need to execute:

tar -xvf 待解包文件名
Copy after login

It should be noted that there is no parameter to directly decompress the xz compression format in the tar command (such as -f to decompress bzip2, -z to decompress gzip)

In fact, tar.xz The format of the compressed package is xz compression after going through the tar packaging folder (-f -z is because tar supports bzip2 and gzip format files by default to be compressed while packaging).

The above is the detailed content of How to decompress .tar.xz files under Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!