星期三, 二月 20, 2008

在 Debian/Ubuntu 上的 7-Zip

不知何時 7-Zip 的 Package 進入 Debian/Ubuntu Linux 中, 之前還為了 .7z 檔, 特別弄台 Windows 去解... Orz...

用 apt-cache search 7zip 可以找到如下的 Package:

  • p7zip - 7zr file archiver with high compression ratio(只能壓/解壓 .7z)
  • p7zip-full - 7z and 7za file archivers with high compression ratio(除了 .7z 還包含 ZIP, Zip64, CAB, RAR, ARJ, GZIP, BZIP2, TAR, CPIO, RPM, ISO and DEB formats)
  • p7zip-rar - non-free rar module for p7zip (可以解 rar 的 module)

使用 apt-get install p7zip-full 即可. 或者乾脆全裝也好... XD

7z壓縮語法

語法: 7z a -t7z -mx=9 -ms=on 壓縮檔名.7z 目錄或檔案

  • -t7z: 7z 存檔
  • -mx: 壓縮效率最佳為 9
  • -ms: 可壓縮目錄, 否則只能壓縮一個檔案

上述命令不會將 Unix 權限存起來, 若要將權限存起來, 還是要用 .tar.7z (先 tar 再 7z)

其它 7z 相關參數

  • 壓縮成執行檔: 7z a -sfx archive.exe directory
  • 壓縮並加密碼: 7z a -mhe=on -pMY_PASSWORD archive.7z a_directory

結合 Tar 常用參數

  • 結合 tar 含目錄壓縮: tar cf - directory | 7za a -si directory.tar.7z
  • 結合 tar 解開 .7z壓縮: 7za x -so directory.tar.7z | tar xf -

實際測試

圖片(352K Screenshot.png)
  • 340K Screenshot.png.7z - "7z" 壓縮圖片
  • 343K Screenshot.png.gz - "gzip -9" 壓縮圖片
隨便找個 Project 來壓縮(原始大小 5.2M)
  • 312K test-9.7z - "7z -mx=9" 壓縮一個 Project(不使用 tar)
  • 327K test.tar.7z - "7z + tar" 壓縮一個 Project
  • 918K test.tar.gz - "gzip + tar" (tar zcvf 壓縮 同上 Project)

其它相關網頁

相關標籤

this is comment icon [回覆]

這個早就了啦
7z是開源的

而且,7z不需要配合tar用吧?
.tar.7z?
汗........

Comment by N (02/21/2008 00:19)

this is comment icon 回 N [回覆]

在我之前要玩的時後還沒有呀, 不知何時放進去的...
7z 要配合 tar 主要是要把權限存下來, 好方便自己的一些平台轉移用.
不然, 7z a -t7z -mx=9 -ms=on 這樣子就可以多個檔案/目錄壓縮囉. :)

Comment by Tsung (02/21/2008 08:56)

this is comment icon peazip [回覆]

Linux/Windows 上還有這個可以玩.. :p

http://www.gnomefiles.org/app.php/PeaZip

Comment by ww (02/23/2008 00:30)

this is comment icon 回 ww [回覆]

哇~ cool..
Full support: 7Z, 7Z-sfx, ARC/WRC, BZ2/TBZ2, GZ/TGZ, PAQ/LPAQ, PEA, QUAD, split, TAR, UPX, ZIP.

Open, browse, extract, test: ACE, ARJ, CAB, CHM, COMPOUND (MSI, DOC, XLS, PPT), CPIO, ISO, Java (JAR, EAR, WAR), Linux (DEB, PET/PUP, RPM, SLP), LHA/LZH, NSIS, OOo, PAK/PK3/PK4, RAR, WIM, XPI, Z/TZ.

真是太強大了, 感謝提供~ :)

Comment by Tsung (02/23/2008 01:17)

this is comment icon [回覆]

印象中早就有了,一只叫p7zip,因为我一直用着呢
7z不保存文件权限,带权限压缩可结合tar
仅存资料的话,还可以用update选项,但记得要先-ms=off,solid格式的文档无法更新。

Comment by Fwolf (02/25/2008 17:23)
Add this page to del.icio.us Add this page to Yahoo Taiwan's bookmark Add this page to MyShare

發表迴響

標題

內容 (限制 1000 字)

暱稱

電子郵件

個人網頁


 authimage


PS: 若無法留言, 請先確認是否有打開 JavaScript, 造成您的困擾, 實在萬分對不起 Orz...(如果無法留言, 勞煩可以發信給我好嗎? 謝謝.)
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~