Linux下解壓tar.xz格式壓縮檔

來源:互聯網
上載者:User

Linux下解壓tar.xz格式壓縮檔        前幾天筆記本新裝的系統,想重新編個核心,結果……傻眼了,居然使用 tar -xvjf  linux-*** 解壓不了,定睛一看,發現現在kernel官網下載的核心壓縮包居然不是bz2了!!!而是tar.xz……What the fuck! 額……不說髒話,啥時候改這個格式了!而且……這特麼是什麼格式?我怎麼沒見過?只能嘗試著搜尋下xz是什麼:【注】:我使用的是 Ubuntu12.04 系統,因而使用的包管理命令是aptitude ,使用別的發行版請使用相應的包管理命令進行![cpp] long@long-Ubuntu:~$ aptitude search xz  p   libxz-java                                                    - Java library with a complete implementation of XZ data compression       p   libxz-java-doc                                                - Documentation for libxz-java                                             p   python-txzookeeper                                            - Twisted-based Asynchronous Libraries for Apache Zookeeper.               v   python2.7-txzookeeper                                         -                                                                          i   xz-utils                                                      - XZ 格式壓縮程式                                                          p   xzdec                                                         - XZ-format compression utilities - tiny decompressors                     p   xzgv                                                          - Picture viewer for X with a thumbnail-based selector                     p   xzip                                                          - Interpreter of Infocom-format story-files                                p   xzoom                                                         - magnify part of X display, with real-time updates                        long@long-Ubuntu:~$    好吧,中文系統就是好!仔細看這一行:[cpp] i   xz-utils                                                      - XZ 格式壓縮程式                                                          直接標識的很清楚,XZ壓縮程式,而且好像我的Ubuntu已經內建的安裝好了(沒有的話就用 apt-get 安裝)!遇事找男人(man一下)唄:man xz 看看怎麼操作   可以看到,xz的用法為:   xz [option]...  [file]...而對應的操作有: -z, --compress              Compress.  This is the default operation mode when no operation mode option is specified and no other operation  mode  is implied from the command name (for example, unxz implies --decompress).壓縮,而且這是預設的操作,也就是說沒有運算元的話 xz 加上檔案就是壓縮!(unxz 可以用來解壓) -d, --decompress, --uncompress              Decompress.解壓縮。和 -z 效果相反 -t, --test              Test  the integrity of compressed files.  This option is equivalent to --decompress --stdout except that the decompressed data is discarded instead of being written to standard output.  No files are created or removed.測試壓縮檔的完整性,這個操作不會產生解壓縮檔案。 -l, --list              Print information about compressed files.  No uncompressed output is produced, and no files are created or  removed.   In list mode, the program cannot read the compressed data from standard input or from other unseekable sources.這個操作會列印檔案的資訊,不會產生解壓縮檔案! 所以,我們從核心官網下載的壓縮檔可以使用下面兩個操作進行解壓:1.首先使用xz解壓 tar.xz檔案:  xz  -d   linux-3.8.4.tar.xz  這個操作會將linux-3.8.4.tar.xz檔案解壓成 linux-3.8.4.tar,然後我們再對 linux-3.8.4.tar 進行解壓。【注】:使用 xz 進行壓縮和解壓過程中都會直接在原檔案上進行,比如說對 tar.xz 解壓後直接就剩下 tar 了,而沒有了原 tar.xz 檔案。可以加 -k 參數(keep)進行保留原檔案2.對linux-3.8.4.tar解壓:tar -xvf  linux-3.8.4.tar   操作完成  最後再補充下 xz utils 的知識:xz utils 是 lzma utils 的下一代lzma utils 改名 xz utils。壓縮時 xz utils 耗時比 bzip2 長一倍,壓縮時 xz utils 耗時是 lzma utils 一半,壓縮時 xz utils 組建檔案體積是 bzip2 的一半,壓縮時 xz utils 組建檔案體積比 lzma utils 略大,解壓時 xz utils 耗時是 bzip2 的三分之一,解壓時 xz utils 速度比 lzma utils 略快,解壓時 xz utils 耗時僅比 gzip 多一倍。壓縮時 xz utils 使用 *.xz 格式 組建檔案 比 *.lzma 格式 略大,測試樣本較小,多次測試結果有出入,無法判斷 xz utils 使用 *.xz 與 *.lzma 格式 壓縮與解壓時間 誰佔優勢。 到目前為止,lzma utils 的壓縮率仍是最大的,xz utils 解壓時間佔優勢。一個 xz 檔案格式的實現XZ 公用程式已可在網上自由獲得。GNU tar自版本1.22起使用這一軟體透明支援xz檔案格式(就如同其處理gzip格式或者bzip2格式一樣)。  隨著大量軟體進入了公有領域(例如 liblzma等) 程式的4.999.9beta版本實現在GNU LGPL 和 GNU GPL條款下發布。 7-Zip在9.04 beta版支援了xz檔案格式,也就是說在windows下遇到 xz 壓縮檔可以使用 7-Zip 解壓。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.