linux下解壓zip文件
linux自帶的unzip命令可以解壓windows下的zip格式的壓縮文件。
unzip命令
語法:unzip [選項] 壓縮文件名.zip
各選項的含義分別為:
-x 文件列表 解壓縮文件,但不包括指定的file文件。
-v 查看壓縮文件目錄,但不解壓。
-t 測試文件有無損壞,但不解壓。
-d 目錄 把壓縮文件解到指定目錄下。
-z 只顯示壓縮文件的注解。
-n 不覆蓋已經(jīng)存在的文件。
-o 覆蓋已存在的文件且不要求用戶確認(rèn)。
-j 不重建文檔的目錄結(jié)構(gòu),把所有文件解壓到同一目錄下。
例1:將壓縮文件text.zip在當(dāng)前目錄下解壓縮。
$ unzip text.zip
例2:將壓縮文件text.zip在指定目錄/tmp下解壓縮,如果已有相同的文件存在,要求unzip命令不覆蓋原先的文件。
$ unzip -n text.zip -d /tmp
例3:查看壓縮文件目錄,但不解壓。
$ unzip -v text.zip
linux zip命令 的基本用法是:
zip [參數(shù)] [打包后的文件名] [打包的目錄路徑]
linux zip命令 參數(shù)列表:
-a 將文件轉(zhuǎn)成ASCII模式
-F 嘗試修復(fù)損壞的壓縮文件
-h 顯示幫助界面
-m 將文件壓縮之后,刪除源文件
-n 特定字符串 不壓縮具有特定字尾字符串的文件
-o 將壓縮文件內(nèi)的所有文件的最新變動時間設(shè)為壓縮時候的時間
-q 安靜模式,在壓縮的時候不顯示指令的執(zhí)行過程
-r 將指定的目錄下的所有子目錄以及文件一起處理
-S 包含系統(tǒng)文件和隱含文件(S是大寫)
-t 日期 把壓縮文件的最后修改日期設(shè)為指定的日期,日期格式為mmddyyyy
舉例:
將/home/Blinux /html/ 這個目錄下所有文件和文件夾打包為當(dāng)前目錄下的html.zip
zip –q –r html.zip /home/Blinux /html
上面的命令操作是將絕對地址的文件及文件夾進行壓縮.以下給出壓縮相對路徑目錄
比如目前在Bliux這個目錄下,執(zhí)行以下操作可以達到以上同樣的效果.
zip –q –r html.zip html
比如現(xiàn)在我的html目錄下,我操作的zip壓縮命令是
zip –q –r html.zip *
以上是在安靜模式下進行的,而且包含系統(tǒng)文件和隱含文件
以下是我在SSH下的幫助,供大家參考:
Copyright (C) 1990-2005 Info-ZIP
Type 'zip "-L"' for software license.
Zip 2.31 (March 8th 2005). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete files)
-r recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-@ read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-y store symbolic links as the link instead of the referenced file
-R PKZIP recursion (see manual)
-e encrypt -n don't compress these suffixes