【Linux】一步一步学Linux——unzip命令(68)
生活随笔
收集整理的這篇文章主要介紹了
【Linux】一步一步学Linux——unzip命令(68)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
00. 目錄
文章目錄
- 00. 目錄
- 01. 命令概述
- 02. 命令格式
- 03. 常用選項
- 04. 參考示例
- 05. 附錄
01. 命令概述
unzip命令用于解壓縮由zip命令壓縮的“.zip”壓縮包。
默認行為(就是沒有選項)是從指定的ZIP存檔中提取所有的文件到當前目錄(及其下面的子目錄)。一個配套程序zip(1L)創建ZIP存檔;這兩個程序都與PKWARE的PKZIP和PKUNZIP為MS-DOS創建的存檔文件兼容,但許多情況下,程序選項或默認行為是不同的。
02. 命令格式
unzip [-Z] [-cflptTuvz[abjnoqsCDKLMUVWX$/:^]] file[.zip] [file(s) ...] [-x xfile(s) ...] [-d exdir]03. 常用選項
-c:將解壓縮的結果顯示到屏幕上,并對字符做適當的轉換; -f:更新現有的文件; -l:顯示壓縮文件內所包含的文件; -p:與-c參數類似,會將解壓縮的結果顯示到屏幕上,但不會執行任何的轉換; -t:檢查壓縮文件是否正確; -u:與-f參數類似,但是除了更新現有的文件外,也會將壓縮文件中的其他文件解壓縮到目錄中; -v:執行時顯示詳細的信息; -z:僅顯示壓縮文件的備注文字; -a:對文本文件進行必要的字符轉換; -b:不要對文本文件進行字符轉換; -C:壓縮文件中的文件名稱區分大小寫; -j:不處理壓縮文件中原有的目錄路徑; -L:將壓縮文件中的全部文件名改為小寫; -M:將輸出結果送到more程序處理; -n:解壓縮時不要覆蓋原有的文件; -o:不必先詢問用戶,unzip執行后覆蓋原有的文件; -P<密碼>:使用zip的密碼選項; -q:執行時不顯示任何信息; -s:將文件名中的空白字符轉換為底線字符; -V:保留VMS的文件版本信息; -X:解壓縮時同時回存文件原來的UID/GID; -d<目錄>:指定文件解壓縮后所要存儲的目錄; -x<文件>:指定不要處理.zip壓縮文件中的哪些文件; -Z:unzip-Z等于執行zipinfo指令。04. 參考示例
4.1 將壓縮文件解壓縮至當前目錄下
[deng@localhost test]$ unzip a Archive: a.zipextracting: a [deng@localhost test]$ ls a a.zip b b.zip c d e [deng@localhost test]$4.2 解壓縮時不覆蓋原有文件
[deng@localhost test]$ ls a a.zip b b.zip c d e [deng@localhost test]$ unzip -n a.zip Archive: a.zip [deng@localhost test]$4.3 解壓縮時覆蓋原有文件
不必詢問用戶,unzip 執行后覆蓋原有文件
[deng@localhost test]$ unzip -o a.zip Archive: a.zipextracting: a [deng@localhost test]$4.4 將壓縮文件解壓縮至指定目錄下
[deng@localhost test]$ mkdir dir [deng@localhost test]$ unzip -n a.zip -d dir/ Archive: a.zipextracting: dir/a [deng@localhost test]$ tree dir dir └── a0 directories, 1 file [deng@localhost test]$4.5 查看壓縮文件目錄(不解壓)
[deng@localhost test]$ unzip -v a.zip Archive: a.zipLength Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ----0 Stored 0 0% 07-24-2019 21:15 00000000 a -------- ------- --- -------0 0 0% 1 file [deng@localhost test]$4.6 顯示注釋內容
[deng@localhost test]$ zip -z aa.zip aadding: a (stored 0%) enter new zip file comment (end with .): 神馬程序員. [deng@localhost test]$ unzip -z aa.zip Archive: aa.zip 神馬程序員 [deng@localhost test]$4.7 顯示文件中內容(不解壓)
[deng@localhost test]$ unzip -l aa.zip Archive: aa.zip 神馬程序員Length Date Time Name --------- ---------- ----- ----0 07-24-2019 21:15 a --------- -------0 1 file [deng@localhost test]$4.8 用一個zipinfo命令來顯示詳細信息
[deng@localhost test]$ zipinfo a.zip Archive: a.zip Zip file size: 152 bytes, number of entries: 1 -rw-rw-r-- 3.0 unx 0 bx stor 19-Jul-24 21:15 a 1 file, 0 bytes uncompressed, 0 bytes compressed: 0.0% [deng@localhost test]$05. 附錄
參考:【Linux】一步一步學Linux系列教程匯總
總結
以上是生活随笔為你收集整理的【Linux】一步一步学Linux——unzip命令(68)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Linux】一步一步学Linux——z
- 下一篇: 【Tools】Linux远程拷贝工具(W