Home  >  Article  >  Operation and Maintenance  >  Detailed explanation on how to decompress .tar.xz files under Linux

Detailed explanation on how to decompress .tar.xz files under Linux

黄舟
黄舟Original
2017-06-07 10:02:164284browse

Preface

I believe many people are unfamiliar with xz compression, but xz is a compression tool that most linux comes with 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

You can also Install using the source code package:

Download the tool source code package first

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

./configure --prefix=/usr/local/xz

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

make && sudo make install

The -s here indicates a soft connection

ln -s /usr/local/xz/bin/xz  /bin/xz

xz –help will see help information about the xz tool indicating installation. Success

Create xz compressed file

xz -z 待压缩文件名

-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 待解压文件

-k Keep the original file;

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

tar -xvf 待解包文件名

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

In fact, the compressed package in tar.

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

Statement:
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