Linux 下壓縮程式比較

原檔
$ ls -l UNUBeaconLogo128.png
-rw-r–r– 1 bananapi bananapi 25102 10月 12 17:16 UNUBeaconLogo128.png

使用 zip 格式
壓縮
# zip UNUBeaconLogo128.png.zip UNUBeaconLogo128.png
解壓縮
# unzip UNUBeaconLogo128.png.zip[@more@]

使用 7z 格式
壓縮
# 7z a
UNUBeaconLogo128.png.7z UNUBeaconLogo128.png
解壓縮
# 7z x UNUBeaconLogo128.png.7z

使用 gz 格式
壓縮(壓縮後原檔會不見)
# gzip
UNUBeaconLogo128.png
解壓縮(解壓縮後壓縮檔會不見)
# gzip -d UNUBeaconLogo128.png.gz
# gunzip UNUBeaconLogo128.png.gz

使用 xz 格式
壓縮(壓縮後原檔會不見)
# xz -z
UNUBeaconLogo128.png
解壓縮(解壓縮後壓縮檔會不見)
# xz -d UNUBeaconLogo128.png.xz
# unxz UNUBeaconLogo128.png.xz

綜合比較:在預設的情況下,不特別加上壓縮參數
$ ls -l UNUBeaconLogo128.png*
-rw-r–r– 1 bananapi bananapi 25102 10月 12 17:16 UNUBeaconLogo128.png
-rw-rw-r– 1 bananapi bananapi 11322 12月 24 13:54 UNUBeaconLogo128.png.7z
-rw-r–r– 1 bananapi bananapi 11378 10月 12 17:16 UNUBeaconLogo128.png.gz
-rw-r–r– 1 bananapi bananapi 11244 10月 12 17:16 UNUBeaconLogo128.png.xz
-rw-rw-r– 1 bananapi bananapi 11529 12月 24 13:54 UNUBeaconLogo128.png.zip

xz > 7z > gz > zip

gz / bz2 / xz 搭配 tar 使用
壓縮
# tar cjzf filename.tar.gz dirname
# tar cvjf filename.tar.bz2 dirname
# tar cvJf filename.tar.xz dirname

解壓縮
# tar xjzf filename.tar.gz
# tar xvjf filename.tar.bz2
# tar xvJf filename.tar.xz