在linux下怎么解压和压缩tar.xz文件?
在linux下解压tar.xz文件步骤
1
2
# xz -d ***.tar.xz //先解压xz
# tar -xvf ***.tar //再解压tar
tar.xz压缩包也是打包后再压缩,外面是xz压缩方式,里层是tar打包方式。
在linux下创建tar.xz文件步骤
1
2
# tar cvf xxx.tar xxx // 这样创建xxx.tar文件先,
# xz -z xxx.tar //将 xxx.tar压缩成为 xxx.tar.xz
Windows下如何解压tar.xz文件?
下载最新版本的7-zip软件即可解压tar.xz文件。
xz是大多数linux默认自带的一个压缩工具,xz 解压命令格式如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Usage: xz [OPTION]... [FILE]...
Compress or decompress FILEs
in
the .xz
format
.
-z, --compress force compression
-d, --decompress force decompression
-t, --
test
test
compressed
file
integrity
-l, --list list information about .xz files
-k, --keep keep (don't delete) input files
-f, --force force overwrite of output
file
and (de)compress links
-c, --stdout write to standard output and don't delete input files
-0 ... -9 compression preset; default is 6; take compressor *and*
decompressor memory usage into account before using 7-9!
-e, --extreme try to improve compression ratio by using
more
CPU
time
;
does not affect decompressor memory requirements
-q, --quiet suppress warnings; specify twice to suppress errors too
-
v
, --verbose be verbose; specify twice
for
even
more
verbose
-h, --help display this short help and
exit
-H, --long-help display the long help (lists also the advanced options)
-V, --version display the version number and
exit
xz压缩文件方法或命令
xz -z 要压缩的文件
如果要保留被压缩的文件加上参数 -k ,如果要设置压缩率加入参数 -0 到 -9调节压缩率。如果不设置,默认压缩等级是6.
如没有按照xz工具,则首先需要下载、安装xz工具:
xz下载
xz安装步骤:
1
2
3
4
5
1、
tar
-jxvf xz-4.999.9beta.
tar
.bz2
2、
cd
xz-4.999.9beta
3、.
/configure
--prefix=/
4、
make
5、
make
install
7-zip介绍
7-Zip 软件基于 GNU 次要公共许可协议(Lesser General Public License) 之下发布,是一款完全免费的压缩解压软件。7-Zip是一款免费开源的解压缩软件,命令行选项具有强大的设置功能,非常适合用来备份,将介绍如何操作。将使用没有图形界面的7-Zip,操作通过命令行完成。这样做的好处之一就是整个软件的程序只有一个文件,适合在U盘中随身携带,易于操作。
7-zip最新版下载地址:
https://sparanoid.com/lab/7z/