Zip command usage: Zip [parameters] < packaged filename > < file/folder > Parameters to be packaged:-a #将文件转为ASCII模式-f #尝 Try to repair the corrupted compressed file-H--help #显示帮助界面-m #压缩后删除源文件-q #安静模式 does not display specific instruction execution procedures during compression-r #递归, all files and subdirectories in the specified directory are compressed together-s #包含系统和隐藏文件-t #把压缩文件的最后修改日期设置为指定日期, format for mmddyyyy-p #带密码加密-e #安全模式加密
Example:
> ls
image-1.jpg image-2.jpg image-3.jpg image-4.jpg image-5.png image-6.png
#压缩指定文件到t. zip
> Zip t.zip image-1.jpg image-2.jpg
adding:image-1.jpg (stored 0)
adding:image-2.jpg (stored 0)
# Compressed file directory
> Zip-r aa.zip file/
#查看压缩文件里的详细文件
> Zipinfo aa.zip
Archive:aa.zip
zip file size : 1120 bytes, number of entries:7 Drwxr-xr-x 3.0 unx 0 stor 15-may-27 10:40 file/-rw-r--r--3.0 unx
0 BX St or 15-may-26 10:17 file/image-4.jpg
-rw-r--r--3.0 unx 0 bx stor 15-may-26 10:17 file/image-3.jpg-rw-r--r--
3.0 Unx 0 bx stor 15-may-26 10:17 file/image-1.jpg-rw-r--r--3.0 unx 0 bx stor 15-may-26 10:17 file/image-6.png-
R w-r--r--3.0 unx 0 bx stor 15-may-26 10:17 file/image-5.png
-rw-r--r--3.0 unx 0 bx stor 15-may-26 10:17 file/image-2 . jpg
7 files, 0 bytes uncompressed, 0 bytes compressed:0.0%
#带密码压缩
> Zip-p
123456-r b.zip file/ #安全模式加密
> Zip-e-R b.zip file/
Enter password:
Verify password:
II. Unzip command usage: Unzip [parameters] < compressed files > [extracted file/path] Parameters:-D #指定解压路径-T #检查文件是否正确
Example: #解压到a目录 > Unzip b.zip-d a/archive:b.zip creating:a/file/extracting:a/file/image-4.jpg Extracting:a/file/imag E-3.jpg extracting:a/file/image-1.jpg extracting:a/file/image-6.png extracting:a/file/image-5.png extracting:a/ File/image-2.jpg > LL Total drwxr-xr-x 3 users, 4096 09:58 a-rw-r--r--1 users users 1120 May 28 09:31 B.zip drwxr-xr-x 2 users 4096 may 10:40 file > cd/> LL total 4 drwxr-xr-x 2 users users 4096 May 27 1 0:40 file #解压到aa目录, AA does not exist, will automatically create > unzip b.zip-d aa #解压其中一个文件到aa目录, image-1.jpg path requires complete (file/image-1.jpg) > Unzip b.zip file/image-1.jpg-d AA > Unzip aa.zip Archive:aa.zip creating:file/extracting:file/image-4.jpg extracting:file/im Age-3.jpg extracting:file/image-1.jpg extracting:file/image-6.png extracting:file/image-5.png extracting:file/ Image-2.jpg > LL Total 8-rw-r--r--1 users (1120) 09:23 Aa.zip drwxr-xr-x 2 users users 4096 may 10:40 F ile > CD file/> LL total 0-rw-r--r--1 Users users 0 may 10:17 image-1.jpg-rw-r--r--1 users users 0 may 10:17 image-2.jpg-rw-r--r--1 users users 0 May 10:17 image-3.jpg-rw-r--r--1 users users 0 may 10:17 image-4.jpg-rw-r--r--1 users users 0 could 10:17 im age-5.png-rw-r--r--1 Users users 0 10:17 image-6.png