1、安装zstd工具

安装命令以及安装过程如下

imaginemiracle@:$ sudo apt-get install zstd
[sudo] password for imaginemiracle: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:zstd
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 343 kB of archives.
After this operation, 1,592 kB of additional disk space will be used.
Get:1 http://ftp.sjtu.edu.cn/ubuntu focal-updates/universe amd64 zstd amd64 1.4.4+dfsg-3ubuntu0.1 [343 kB]
Fetched 343 kB in 4s (89.0 kB/s)
Selecting previously unselected package zstd.
(Reading database ... 204343 files and directories currently installed.)
Preparing to unpack .../zstd_1.4.4+dfsg-3ubuntu0.1_amd64.deb ...
Unpacking zstd (1.4.4+dfsg-3ubuntu0.1) ...
Setting up zstd (1.4.4+dfsg-3ubuntu0.1) ...
Processing triggers for man-db (2.9.1-1) ...

2、zstd格式解压缩命令

扩展名.zst表示存档由zstd压缩。
tar命令有一个选项-I( -  use-compress-program)来指定压缩/解压缩命令。
解压命令:
$ tar -I zstd -xvf filename.tar.zst
压缩命令
$ tar -I zstd -cvf filename.tar.zst files

实例应用:

#压缩命令实例
imaginemiracle@:$ tree
.
└── zstd_test├── hello└── world3 directories, 0 files
imaginemiracle@:$ tar -I zstd -cvf zstd_test.tar.zst zstd_test/
zstd_test/
zstd_test/hello/
zstd_test/world/
imaginemiracle@:$ ls
zstd_test  zstd_test.tar.zst#解压命令实例
imaginemiracle@:$ rm zstd_test -rf 
imaginemiracle@:$ ls
zstd_test.tar.zst
imaginemiracle@:$ tar -I zstd -vxf zstd_test.tar.zst 
zstd_test/
zstd_test/hello/
zstd_test/world/