安装: 网上都是下载编译好的可执行文件or apt-get 软件源安装,为了不那么麻烦,直接用源码安装~是的源码安装比apt-get更简单...
git clone https://coding.net/u/code33/p/lz4/git
cd lz4
make
make install
注意这里的 make install 需要root身份操作,因为涉及到/usr/bin 路径下面的操作 或者 自己看看 Makefile 里面的脚本,也可自定义可执行文件的安装路径
安装成功后测试一下
lz4 --version
看到这条帮助,可以直接用在各种tar 打包 压缩的命令使用的压缩程序参数
tar --help : -I, --use-compress-program=PROG
平常是这样用的
tar -I 'xz -9' -cvf foo.tar.xz foo/
tar -I 'gzip -9' -cvf foo.tar.gz foo/
那么lz4 也可以这样用
also compress with non tar-native compressors: 创建压缩文档
tar -I 'lz4 -1' -cvf foo.tar.lz4 foo/
tar -I 'zstd -9' -cvf foo.tar.zst foo/
注意 这里的lz4 -数值,意思是压缩比 ,从1-9 越大越狠
decompress non tar-native compressors: 解压压缩文档
tar -I lz4 -xvf foo.tar.lz4
tar -I zstd -xvf foo.tar.zst
list archive non tar-native compressors: 列出压缩文档
tar -I lz4 -tvf foo.tar.lz4
tar -I zstd -tvf foo.tar.zst
安装部分为原创 使用命令部分参考此贴 https://unix.stackexchange.com/questions/28976/how-to-xz-a-directory-with-tar-using-maximum-compress