用tar解壓縮壓縮包裡的某個指定檔案

來源:互聯網
上載者:User

 

用tar解壓縮壓縮包裡的某個指定檔案第一步先查看壓縮包裡有那些檔案,比如壓縮包名為: a.tar.bz2

[root@localhost home]# tar -jtvf a.tar.bz2 (查看包裡的檔案有那些)
drwxr-xr-x root/root 0 2008-09-09 17:55 a/
-rw-r--r-- root/root 21 2008-09-09 17:52 a/222
-rw-r--r-- root/root 12 2008-09-09 17:53 a/111
-rw-r--r-- root/root 10 2008-09-09 17:54 a/333

可以看見有 111 222 333 三個檔案
現在要單獨解壓出333檔案,就是下面的命令

[root@localhost home]# tar -jxvf a.tar.bz2 a/333 (單獨解壓333)
a/333
[root@localhost home]# ll (查看一下解出來沒有,已經有a檔案夾了)
總計 32
drwx------ 4 11 11 4096 09-09 14:13 11
drwxr-xr-x 2 root root 4096 09-09 18:59 a
-rw-r--r-- 1 root root 188 09-09 18:37 a.tar.bz2
drwx------ 2 root root 16384 2006-12-25 lost+found
[root@localhost home]# cd a (進入檔案夾)
[root@localhost a]# ll (顯示內容)
總計 4
-rw-r--r-- 1 root root 10 09-09 17:54 333

333檔案已經單獨解壓出來了

 

聯繫我們

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