一 語法
gzip 原始檔
壓縮為.gz格式的壓縮檔案,原始檔會消失
gzip -c 原始檔 > 壓縮檔案
壓縮為.gz格式,原始檔保留
gzip -r 目錄
壓縮目下的所有子檔案,但不能壓縮目錄
gzip -d 壓縮檔案
解壓縮檔案
gunzip 壓縮檔案
解壓縮檔案
二 實戰
[root@localhost test]# ls
abc cdf dirtst
[root@localhost test]# gzip abc
[root@localhost test]# ls
abc.gz cdf dirtst
[root@localhost test]# gzip -c cdf > cdf.gz
[root@localhost test]# ls
abc.gz cdf cdf.gz dirtst
[root@localhost test]# gzip -r dirtst
[root@localhost test]# ls
abc.gz cdf cdf.gz dirtst
[root@localhost test]# ls dirtst/
ert.gz
[root@localhost test]# ls
abc.gz cdf.gz dirtst
[root@localhost test]# gzip -d abc.gz
[root@localhost test]# ls
abc cdf.gz dirtst
[root@localhost test]# gunzip cdf.gz
[root@localhost test]# ls
abc cdf dirtst
[root@localhost test]# gunzip -r dirtst/
[root@localhost test]# ls dirtst/
ert
Linux 解壓 gz 格式壓縮包
解決方法 需要在在gz的壓縮包兩邊家加上單引號才可以,不然就會出出現錯誤資訊 謹慎地拒絕建立空歸檔檔案 下面附錄 tar 針對不同的格式解壓縮命令 一 tar 可壓縮可解壓 引數副選項 使用方法 解包 tar xvf 被解包的檔名稱 tar命令可以使用引數 z,以gzip方式將檔案壓縮或者解壓。一般...
linux下 bz2同 gz壓縮檔案格式的區
bz2和.gz都是linux下壓縮檔案的格式,有點類似windows下的.zip和.rar檔案。bz2和.gz的區別在於,前者比後者壓縮率更高,後者比前者花費更少的時間。也就是說同乙個檔案,壓縮後,bz2檔案比.gz檔案更小,但是.bz2檔案的小是以花費更多的時間為代價的。壓縮例項 對乙個599m的...
把目錄 資料夾 打包為gz格式的壓縮包
gzip只有解壓功能,沒有壓縮打包功能。如果想要將資料夾 目錄 打包成gz格式的壓縮包,需要用tar命令。把資料夾打包為tar.gz命令 tar zcvf 檔名.tar.gz 要壓縮的檔案 資料夾 例如,把webfile目錄 包括裡面的檔案 壓縮為webfile.tar.gz,命令 tar zcvf...