xz的用法为: xz [option]... [file]...
而对应的操作有:
-z, --compress
Compress. This is the default operation mode when no operation mode option is specified and no other operation mode is implied from the command name (for example, unxz implies --decompress).
压缩,而且这是默认的操作,也就是说没有操作数的话 xz 加上文件就是压缩!(unxz 可以用来解压)
-d, --decompress, --uncompress
Decompress.
解压缩。和 -z 效果相反
-t, --test
Test the integrity of compressed files. This option is equivalent to --decompress --stdout except that the decompressed data is discarded instead of being written to standard output. No files are created or removed.
测试压缩文件的完整性,这个操作不会生成解压缩文件。
-l, --list
Print information about compressed files. No uncompressed output is produced, and no files are created or removed. In list mode, the program cannot read the compressed data from standard input or from other unseekable sources.
这个操作会打印文件的信息,不会生成解压缩文件!
所以,我们从内核官网下载的压缩文件可以使用下面两个操作进行解压:
1.首先使用xz解压 tar.xz文件: xz -d linux-3.8.4.tar.xz
这个操作会将linux-3.8.4.tar.xz文件解压成 linux-3.8.4.tar,然后我们再对 linux-3.8.4.tar 进行解压。
【注】:使用 xz 进行压缩和解压过程中都会直接在原文件上进行,比如说对 tar.xz 解压后直接就剩下 tar 了,而没有了原 tar.xz 文件。可以加 -k 参数(keep)进行保留原文件