2015/03/27圧縮と解包


一、gzip圧縮と解包
     1. 圧縮;
[root@Centos1 ~]# gzip 2.txt

     2. 包みを解く
[root@Centos1 ~]# gzip -d 2.txt.gz

     3. パッケージの圧縮内容を表示します.
[root@Centos1 ~]# zcat 1.txt.gz

二、bzip圧縮と解包
     1. 圧縮;
[root@Centos1 ~]# bzip2 2.txt

     2. 包みを解く
[root@Centos1 ~]# bzip2 -d 2.txt.bz2

     3. 圧縮パッケージの内容を表示します.
[root@Centos1 ~]# bzcat 2.txt.bz2

三、zip圧縮と解包
     1. 圧縮;
[root@Centos1 ~]# zip 2.zip 2.txt 
[root@Centos1 ~]# zip -r etc.zip /etc           #    

     2. 包みを解く
[root@Centos1 ~]# unzip etc.zip  
[root@Centos1 ~]# unzip -d /tmp etc.zip         #   /tmp 

     3. 圧縮パッケージの内容を表示します.
[root@Centos1 ~]# unzip -l etc.zip

四、tar圧縮と解包
     1. あっしゅく
[root@Centos1 ~]# tar -zcvf 1.tar.zg /etc
[root@Centos1 ~]# tar -jcvf 1.tar.bz2 /etc
[root@Centos1 ~]# tar -cvf 1.tar /etc
[root@Centos1 ~]# tar -cvf 1.tar --exclude "*.sh" -exclude "*i386" /etc   
#exclude    

     2. かばんを解く
[root@Centos1 ~]# tar -zxvf 1.tar.zg
[root@Centos1 ~]# tar -jxvf 1.tar.bz2
[root@Centos1 ~]# tar -xvf 1.tar 
[root@Centos1 ~]# tar -xvf 1.tar  -C /tmp          #   /tmp 

     3. 圧縮されたコンテンツの表示
[root@Centos1 ~]# tar -tf 1.tar          #