linux 中 压缩、解压缩、查看gz文件保留源文件
001、压缩为gz文件,同时保留源文件
[root@pc1 test]# ls a.txt [root@pc1 test]# gzip -c a.txt > a.txt.gz ## 压缩文件,同时保留源文件 [root@pc1 test]# ls a.txt a.txt.gz

002、 解压缩gz文件保留源文件
[root@pc1 test]# ls a.txt.gz [root@pc1 test]# gunzip -c a.txt.gz > a.txt ## 解压缩文件,保留源文件 [root@pc1 test]# ls a.txt a.txt.gz

003、查看gz压缩文件,同时保留源文件
[root@pc1 test]# ls a.txt.gz [root@pc1 test]# zcat a.txt.gz | head -n 3 ## 查看gz压缩文件,保留源文件 1 2 3 [root@pc1 test]# zcat a.txt.gz | tail -n 3 98 99 100

。

浙公网安备 33010602011771号