Home > Article > Operation and Maintenance > Detailed explanation on how to decompress .tar.xz files under Linux
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.
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
xz -z 待压缩文件名
-k Keep the original file;
-0 to -9 adjust the compression ratio. If not set, the default compression level is 6;
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!