Linux命令 - unzip命令
生活随笔
收集整理的這篇文章主要介紹了
Linux命令 - unzip命令
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Linux命令 - unzip命令
??Linux中 unzip 命令是為.zip壓縮文件的解壓縮程序。
1.語法:
unzip [參數] [文件或目錄]
2.功能:
??解壓縮zip文件。
3.參數:
-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。 [.zip文件] 指定.zip壓縮文件。 [文件] 指定要處理.zip壓縮文件中的哪些文件。 -d<目錄> 指定文件解壓縮后所要存儲的目錄。 -x<文件> 指定不要處理.zip壓縮文件中的哪些文件。 -Z unzip -Z等于執行zipinfo指令。4.常用范例:
例一:查看壓縮文件中包含的文件
命令:unzip -l test.zip
[root@localhost test]# unzip -l test.zip Archive: test.zipLength Date Time Name --------- ---------- ----- ----96 05-25-2021 15:10 color.sh96 05-18-2021 10:15 lncolor13 05-25-2021 10:58 log1.txt592 05-14-2021 17:00 log2.txt655 05-14-2021 17:06 log3.txt52 05-25-2021 10:58 log.txt --------- -------1504 6 files例二:查看壓縮文件目錄信息,但是不解壓該文件
命令:unzip -v test.zip
[root@localhost test]# unzip -v test.zip Archive: test.zipLength Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ----96 Defl:N 51 47% 05-25-2021 15:10 cba5c603 color.sh96 Defl:N 51 47% 05-18-2021 10:15 cba5c603 lncolor13 Stored 13 0% 05-25-2021 10:58 7a7f61b4 log1.txt592 Defl:N 161 73% 05-14-2021 17:00 45fe6d2e log2.txt655 Defl:N 137 79% 05-14-2021 17:06 5c81697f log3.txt52 Defl:N 37 29% 05-25-2021 10:58 e7951b29 log.txt -------- ------- --- -------1504 450 70% 6 files例三:將test.zip解壓到當前文件下
命令: unzip test.zip
??源壓縮文件不會被刪除。
[root@localhost test]# unzip test.zip Archive: test.zipinflating: color.sh inflating: lncolor extracting: log1.txt inflating: log2.txt inflating: log3.txt inflating: log.txt [root@localhost test]# ll 總用量 28 -rw-r--r--. 1 root root 96 5月 25 15:10 color.sh -rwxr--r--. 1 root root 96 5月 18 10:15 lncolor ---xr--r--. 1 root root 13 5月 25 10:58 log1.txt -rwxrw-r-x. 1 root root 592 5月 14 17:00 log2.txt -rwxr-x--x. 1 root root 655 5月 14 17:06 log3.txt -rwxr--r--. 1 root root 52 5月 25 10:58 log.txt -rw-r--r--. 1 root root 1332 5月 25 16:33 test.zip例四:將test.zip解壓到/games目錄下,并且不要覆蓋已有文件
命令: unzip -n test.zip -d /usr/games/
[root@localhost test]# unzip -n test.zip -d /usr/games/ Archive: test.zipinflating: /usr/games/lncolor extracting: /usr/games/log1.txt inflating: /usr/games/log2.txt inflating: /usr/games/log3.txt inflating: /usr/games/log.txt [root@localhost test]# cd ../ [root@localhost games]# ll 總用量 36 -rw-r--r--. 1 root root 96 5月 25 15:16 color.sh -rwxr--r--. 1 root root 96 5月 18 10:15 lncolor ---xr--r--. 1 root root 13 5月 25 10:58 log1.txt -rwxrw-r-x. 1 root root 592 5月 14 17:00 log2.txt -rwxr-x--x. 1 root root 655 5月 14 17:06 log3.txt -rwxr--r--. 1 root root 52 5月 25 10:58 log.txt drwxr-xr-x. 2 root root 116 5月 25 17:07 test -rw-r--r--. 1 root root 3016 5月 25 16:36 test1.zip -rw-r--r--. 1 root root 3211 5月 25 16:40 test2.zip -rw-r--r--. 1 root root 3016 5月 25 16:42 test3.zip例五:將test.zip解壓到/tmp目錄下,并且覆蓋已有文件
命令: unzip -o test.zip -d /usr/games/
??壓縮的是包括test目錄及以下的文件和文件夾。
[root@localhost test]# unzip -o test.zip -d /usr/games/ Archive: test.zipinflating: /usr/games/color.sh inflating: /usr/games/lncolor extracting: /usr/games/log1.txt inflating: /usr/games/log2.txt inflating: /usr/games/log3.txt inflating: /usr/games/log.txt [root@localhost test]# ll 總用量 28 -rw-r--r--. 1 root root 96 5月 25 15:10 color.sh -rwxr--r--. 1 root root 96 5月 18 10:15 lncolor ---xr--r--. 1 root root 13 5月 25 10:58 log1.txt -rwxrw-r-x. 1 root root 592 5月 14 17:00 log2.txt -rwxr-x--x. 1 root root 655 5月 14 17:06 log3.txt -rwxr--r--. 1 root root 52 5月 25 10:58 log.txt -rw-r--r--. 1 root root 1332 5月 25 16:33 test.zip總結
以上是生活随笔為你收集整理的Linux命令 - unzip命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: FreeRTOS学习-day01
- 下一篇: python项目方案书模板格式_项目策划