linux壓縮資料

來源:互聯網
上載者:User

標籤:linux   tar   

linux檔案壓縮公用程式

工具 副檔名 描述
bzip2 .bz2 使用burrows-wheeler塊排序文本壓縮演算法
compress .Z 原UNIX檔案壓縮公用程式
gzip .gz GNU項目壓縮公用程式
zip .zip Unix版本的windows PKZIP程式

1.bzip2工具

bzip 用於壓縮檔
bzcat 用於顯示已壓縮文字檔內容
bunzip2 用於解壓.bz2檔案
bzip2recover 用於嘗試修複受損的壓縮檔

樣本:

用bzip2壓縮myprog檔案

[[email protected] ~]# ls -l myprog 

-rw-r--r-- 1 root root 0 11-06 10:54 myprog

[[email protected] ~]# bzip2 myprog 

[[email protected] ~]# ls -l my*

-rw-r--r-- 1 root root 14 11-06 10:54 myprog.bz2

*****************************************************

用bunzip2解壓myprog.bz2檔案

[[email protected] ~]# bunzip2 myprog.bz2 

[[email protected] ~]# ls -l myprog 

-rw-r--r-- 1 root root 77 11-06 10:56 myprog


2.gzip工具

gzip 用於壓縮檔
gzcat 用於顯示壓縮後的檔案內容
gunzip 用於解壓檔案

壓縮:

[[email protected] ~]# gzip myprog 

[[email protected] ~]# ls -l my*

-rw-r--r-- 1 root root 70 11-06 10:56 myprog.gz

解壓:

[[email protected] ~]# gunzip myprog.gz 

[[email protected] ~]# ls -l my*

-rw-r--r-- 1 root root 77 11-06 10:56 myprog


3.zip工具

zip 建立包含列出檔案和目錄壓縮檔
zippcloak 建立包含列出檔案和目錄加密壓縮檔
zipnote 用於提取zip檔案中注釋
zipsplit 用於將zip檔案分割成指定大小的多個檔案
unzip 用於提取壓縮zip檔案中的檔案和目錄


4.tar歸檔命令

tar用於將檔案歸檔,還可以將輸入寫入到檔案中

-A --concatenate 將已有tar歸檔檔案添加到另一個已有歸檔檔案中
-c --create 建立一個新tar歸檔檔案
-d  --diff 檢查tar歸檔檔案和檔案系統之間的差異

--delete 從已有tar歸檔檔案刪除
-r  --append 將檔案添加到已有tar歸檔檔案末尾
-t  --list 列出現有tar歸檔檔案內容
-u  --update 更新現有tar歸檔檔案中的檔案
-x --extract 解壓現有歸檔檔案
-C  --dir 切換到指定目錄
-f  --file 輸出結果到檔案或裝置
-j

將輸出從定向到bzip2命令壓縮
-p 
保留所有檔案許可權
-v
在處理過程中列出檔案
-z
將輸出從定向到gzip命令進行壓縮

[[email protected] ~]# tar -cvf test.tar test/ test2/

建立一個名為test.tar的歸檔檔案,其中包含test1和test2目錄的內容


[[email protected] ~]# tar -tf test.tar

列出(但不解壓)tar檔案test.tar的內容


[[email protected] ~]# tar -xvf test.tar

解壓test.tar檔案內容

本文出自 “linux營運分享” 部落格,請務必保留此出處http://liangey.blog.51cto.com/9097868/1572859

linux壓縮資料

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.