檔案的打包和壓縮
指令:
targzipbzip2
打包和壓縮分開做:
==============
1. 打包
[root@station230 ~]# tar -cvf etc1.tar /etc
[root@station230 ~]# tar -cf etc2.tar /etc/
2. 壓縮
[root@station230 ~]# gzip etc1.tar
[root@station230 ~]# bzip2 etc2.tar
[root@station230 ~]# ll -h etc*
-rw-r--r-- 1 root root 11M 09-07 12:38 etc1.tar.gz
-rw-r--r-- 1 root root 6.9M 09-07 12:41 etc2.tar.bz2
<a href="http://s3.51cto.com/wyfs02/M00/23/99/wKioL1M7lFWhKP_SAAF3zNHlyE0692.jpg" target="_blank"></a>
===================================================
1. 解壓
[root@station230 ~]# gzip -d etc1.tar.gz
[root@station230 ~]# bzip2 -d etc2.tar.bz2
2. 解包
[root@station230 ~]# tar -xvf etc1.tar
打包和壓縮一起做:
[root@station230 ~]# tar -czvf etc1.tar.gz /etc// -z 表示調用gzip
[root@station230 ~]# tar -cjf etc2.tar.bz2 /etc// -j 表示調用bzip2
=======
[root@station230 ~]# tar -xvf etc1.tar.gz
[root@station230 ~]# tar xvf etc1.tar.gz
[root@station230 ~]# tar -xvf etc1.tar.gz -C /tmp
tar xf 檔案
本文轉自zhang25yun51CTO部落格,原文連結: http://blog.51cto.com/1585654/1388982,如需轉載請自行聯系原作者