vhd-爱奇艺万能播放器
2023年4月4日发(作者:淘宝助理5)
linuxlz4源码下载,Linux下lz4解压缩命令⼩结
lz4是⼀个让"⼈见⼈爱、花见花开"的压缩算法,能够在多核上很好的扩展。lz4在压缩率上略微逊⾊,但是在解压速度上有着惊⼈的优势(⼤
概是gzip的3倍(多次测试对⽐))。因为压缩时⾼效的多核利⽤,再加上惊艳的解压,lz4已经在⾮常多重要场合使⽤了!对于需要频繁压缩、
实时快速解压的场景来说,lz4⾮常适合;lz4解压缩的对象是⽂件⽽不是⽬录。
1)lz4⼯具安装
#yuminstall-ylz4lz4-devel
2)lz4解压缩命令格式
压缩(默认解压之后的名称4)
#lz4filename
解压缩
#4
centos7下默认有lz4_decompress命令,可以直接解压,并可以定义解压后的⽂件名
#lz4_4filename
#lz4_
3)lz4参数解释
查看帮助
[root@localhost~]#lz4--help
参数
-1:快速压缩(默认)
-9:⾼压缩
-d:解压缩(默认为.lz4扩展名)
-z:强制压缩
-f:覆盖输出⽽不提⽰
-k:保留源⽂件(默认)
--rm:成功地解除/压缩后删除源⽂件
-h/-h:显⽰帮助/长帮助和退出
⾼级参数
-v:显⽰版本号并退出
-v:详细模式
-q:取消警告;指定两次也可以取消错误
-c:强制写⼊标准输出,即使它是控制台
-t:测试压缩⽂件完整性
-m:多个输⼊⽂件(表⽰⾃动输出⽂件名)
-r:在⽬录上递归操作(也设置为-m)
-l:使⽤旧格式压缩(Linux内核压缩)
4)lz4解压缩⽰例
[root@MGR-node3~]#cat/etc/redhat-release
CentOSLinuxrelease7.5.1804(Core)
[root@MGR-node3~]#cd/opt/
[root@localhostopt]#ls
test
[root@localhostopt]#cattest
haha,helloworld!!
1)对test⽂件进⾏压缩
[root@localhostopt]#lz4test
Compressedfilenamewillbe:4
Compressed8bytesinto27bytes==>337.50%
[root@localhostopt]#ls
4
快速压缩(-1参数),默认的就是快速压缩,如上⾯那条命令
[root@localhostopt]#4
[root@localhostopt]#lz4-1test
Compressedfilenamewillbe:4
Compressed8bytesinto27bytes==>337.50%
[root@localhostopt]#ls
4
⾼压缩(-9参数)
[root@localhostopt]#4
[root@localhostopt]#lz4-9test
Compressedfilenamewillbe:4
Compressed8bytesinto27bytes==>337.50%
[root@localhostopt]#ls
4
当出现同名压缩⽂件时,直接压缩默认会有是否覆盖的提⽰信息
[root@localhostopt]#lz4-9test
Compressedfilenamewillbe:4
4alreadyexists;doyouwishtooverwrite(y/N)?y
Compressed8bytesinto27bytes==>337.50%
已存在同名压缩⽂件时,直接压缩⽽不输出是否覆盖的提⽰信息
[root@localhostopt]#lz4-9-ftest
Compressedfilenamewillbe:4
Compressed8bytesinto27bytes==>337.50%
[root@localhostopt]#ls
4
压缩⽂件时,保留源⽂件(-f参数),默认压缩后就是保留源⽂件,所以-f参数加不加都可以
[root@localhostopt]#4
[root@localhostopt]#lz4test
Compressedfilenamewillbe:4
Compressed8bytesinto27bytes==>337.50%
[root@localhostopt]#ls
4
[root@localhostopt]#4
[root@localhostopt]#lz4-ftest
Compressedfilenamewillbe:4
Compressed8bytesinto27bytes==>337.50%
[root@localhostopt]#ls
4
压缩成功后,将源⽂件删除(--rm参数)
[root@localhostopt]#4
[root@localhostopt]#ls
test
[root@localhostopt]#lz4--rmtest
Compressedfilenamewillbe:4
Compressed8bytesinto27bytes==>337.50%
[root@localhostopt]#ls
4
2)对压缩⽂件进⾏解压缩
默认通过-d参数进⾏解压缩
[root@localhostopt]#ls
4
[root@localhostopt]#4
Decodingfiletest
4:decoded8bytes
[root@localhostopt]#ls
4
[root@localhostopt]#cattest
haha,helloworld!!
也可以使⽤lz4_decompress命令进⾏解压缩,并且可以⾃定义解压缩之后的⽂件名
[root@localhostopt]#rm-ftest
[root@localhostopt]#ls
4
[root@localhostopt]#lz4_4kevin#将4解压缩,解压缩之后为kevin⽂件
[root@localhostopt]#ls
4
[root@localhostopt]#catkevin
haha,helloworld!!
3)压缩时,取消告警提⽰信息(-q参数)
[root@localhostopt]#4
[root@localhostopt]#ls
kevin
[root@localhostopt]#lz4-qkevin
[root@localhostopt]#ls
4
[root@localhostopt]#lz4-q-fkevin
[root@localhostopt]#lz4-q-f--rmkevin
[root@localhostopt]#ls
4
4)对多个⽂件进⾏匹配压缩
[root@localhostopt]#ls
bobokevin
[root@localhostopt]#lz4-mbobokevin
[root@localhostopt]#ls
4
[root@localhostopt]#rm-rfbobokevin
[root@localhostopt]#ls
4
[root@localhostopt]#4-q
[root@localhostopt]#4-q
[root@localhostopt]#ls
4
更多推荐
压缩下载
发布评论