zip壓縮工具,unzip解壓縮工具

zip壓縮工具,unzip解壓縮工具
===================

[root@aminglinux tmp]# yum install -y zip
[root@aminglinux tmp]# yum install -y unziplinux

示例:工具

[root@aminglinux yasuo]# ls
1.txt 2.txt 3.txt dir1
[root@aminglinux yasuo]# zip 1.txt.zip 1.txt                      //zip後面先跟壓縮後自定義的壓縮包名,而後再跟要壓縮的文件或者目錄
adding: 1.txt (deflated 67%)
[root@aminglinux yasuo]# ls
1.txt 1.txt.zip 2.txt 3.txt dir1blog

[root@aminglinux yasuo]# zip -r dir1.zip dir1                  //zip支持壓縮目錄,必須加上-r選項,才能壓縮二級目錄下的文件ip

adding: dir1/ (stored 0%)
adding: dir1/dir2/ (stored 0%)
adding: dir1/dir2/dir3/ (stored 0%)
adding: dir1/dir2/dir3/3.txt (deflated 67%)
adding: dir1/dir2/2.txt (deflated 67%)
adding: dir1/1.txt (deflated 67%)file

[root@aminglinux yasuo]# lsim

1.txt 1.txt.zip 2.txt 3.txt dir1 dir1.zip yum

[root@aminglinux yasuo]# unzip 1.txt.zip
Archive: 1.txt.zip
replace 1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: 1.txt
[root@aminglinux yasuo]# unzip 1.txt.zip
Archive: 1.txt.zip
replace 1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: r
new name: 1.txt.new
inflating: 1.txt.new
[root@aminglinux yasuo]# ls
1.txt 1.txt.new 1.txt.zip 2.txt 3.txt dir1 dir1.zip                       //1.txt.new就是解壓縮後重命名的文件
[root@aminglinux yasuo]# unzip dir1.zip
Archive: dir1.zip
replace dir1/dir2/dir3/3.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
inflating: dir1/dir2/dir3/3.txt
inflating: dir1/dir2/2.txt
inflating: dir1/1.txt
[root@aminglinux yasuo]# unzip -o dir1.zip                     //-o:沒必要先詢問用戶,unzip執行後覆蓋原有的文件;
Archive: dir1.zip
inflating: dir1/dir2/dir3/3.txt
inflating: dir1/dir2/2.txt
inflating: dir1/1.txt
命名

[root@aminglinux yasuo]# unzip dir1.zip -d /root/666/       //-d<目錄>:指定文件解壓縮後所要存儲的目錄;img

Archive: dir1.zip
creating: /root/666/dir1/
creating: /root/666/dir1/dir2/
creating: /root/666/dir1/dir2/dir3/
inflating: /root/666/dir1/dir2/dir3/3.txt
inflating: /root/666/dir1/dir2/2.txt
inflating: /root/666/dir1/1.txt
[root@aminglinux yasuo]# tree /root/666
/root/666
└── dir1
├── 1.txt
└── dir2
├── 2.txt
└── dir3
└── 3.txt

3 directories, 3 files
di

[root@aminglinux yasuo]# unzip -l dir1.zip                 //-l:顯示壓縮文件內所包含的文件;

Archive: dir1.zip
Length Date Time Name
--------- ---------- ----- ----
0 07-01-2018 17:34 dir1/
0 07-01-2018 17:35 dir1/dir2/
0 07-01-2018 17:35 dir1/dir2/dir3/
32208 07-01-2018 17:35 dir1/dir2/dir3/3.txt
32208 07-01-2018 17:35 dir1/dir2/2.txt
32208 07-01-2018 17:34 dir1/1.txt
--------- -------
96624 6 files

[root@aminglinux yasuo]# unzip -v 1.txt.zip              //-v:執行時顯示詳細的信息;

Archive: 1.txt.zip Length Method Size Cmpr Date             Time               CRC-32 Name--------       ------ ------- ---- ----------          -----                  -------- ---- 32208 Defl:N 10580 67% 07-01-2018 16:25 e89832ac 1.txt---                     ------- ---    ------- 32208            10580 67% 1 file

相關文章
相關標籤/搜索