[root@localhost soft]# unzip QY.zip
Archive: QY.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of QY.zip or
QY.zip.zip, and cannot find QY.zip.ZIP, period.
剛開始以為是壓縮包文件部分信息丟失,導致解壓出錯了,不應該呀,怎么會出錯呢,,emmmm,還是感覺不對勁,於是Google了下:
- 一般在linux下解壓zip文件,直接用系統默認的extract here進行解壓(默認使用的是 unzip)
- 如果壓縮文件.zip是大於2G的,那unzip就無法使用了,這是由於C庫中long類型數據所能表示的文件偏移在32位機子上只能有2G
- 所以如果要解壓大文件,可以使用7zip來解壓
-
如果執行make命令時,提示安裝g++的話,請執行
yum install gcc-c++
-
出現 tar (child): bzip2: Cannot exec: No such file or directory,請安裝
yum install bzip2 -y
發現yum install p7zip -y 也可以安裝
./install.sh /usr/local/bin /usr/local/lib/p7zip /usr/local/man /usr/local/share/doc/p7zip
- installing /usr/local/bin/7za
- installing /usr/local/man/man1/7z.1
- installing /usr/local/man/man1/7za.1
- installing /usr/local/man/man1/7zr.1
- installing /usr/local/share/doc/p7zip/README
- installing /usr/local/share/doc/p7zip/ChangeLog
- installing HTML help in /usr/local/share/doc/p7zip/DOC
7z命令的使用
解壓縮7z文件
7za x test.zip -r -o./
參數含義:
- x 代表解壓縮文件,並且是按原始目錄樹解壓(還有個參數 e 也是解壓縮文件,但其會將所有文件都解壓到根下,而不是自己原有的文件夾下)
- test.zip 是當前目錄下的壓縮文件,這里用做測試文件
- -r 表示遞歸解壓縮所有的子文件夾
- -o 是指定解壓到的目錄,-o后是沒有空格的,直接接目錄(-o./ 為當前目錄)
壓縮文件/文件夾
7za a -t7z -r test.7z /opt/test/*
- 1
參數含義:
- a 代表添加文件/文件夾到壓縮包
- -t 是指定壓縮類型,這里定為7z,可不指定,因為7za默認壓縮類型就是7z
- -r 表示遞歸所有的子文件夾
- test.7z 是壓縮好后的壓縮包名
- /opt/test/* 是壓縮目錄
注意:7za不僅僅支持.7z壓縮格式,還支持.zip.、tar、.bz2等壓縮類型
unzip解壓失敗可歸結為是壓縮格式不對
tar包壓縮和tar解壓失敗有遇到的嗎、???
“tar czvf /mnt/etc-$(date +%F-%T).tar.zg /etc/*”
這個沒有錯,可以解壓
tar czvf /mnt/etc-$(date +%F-%T).tar.zg /root/22/
tar czf 33/$(date +%F).tar.gz 22
tar czf 33/$(date +%T).tar.gz 22/
都會出現 壓縮包可以完成,但是解壓不行
出現報錯 不能解壓