安装7zip
root@iZbp1jen89mchqqplvbrk5Z:/# apt install p7zip-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
p7zip
Suggested packages:
p7zip-rar
The following NEW packages will be installed:
p7zip p7zip-full
0 upgraded, 2 newly installed, 0 to remove and 25 not upgraded.
Need to get 1,522 kB of archives.
After this operation, 5,755 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/universe amd64 p7zip amd64 16.02+dfsg-6 [358 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/universe amd64 p7zip-full amd64 16.02+dfsg-6 [1,164 kB]
Fetched 1,522 kB in 0s (17.3 MB/s)
Selecting previously unselected package p7zip.
(Reading database ... 133046 files and directories currently installed.)
Preparing to unpack .../p7zip_16.02+dfsg-6_amd64.deb ...
Unpacking p7zip (16.02+dfsg-6) ...
Selecting previously unselected package p7zip-full.
Preparing to unpack .../p7zip-full_16.02+dfsg-6_amd64.deb ...
Unpacking p7zip-full (16.02+dfsg-6) ...
Setting up p7zip (16.02+dfsg-6) ...
Setting up p7zip-full (16.02+dfsg-6) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@iZbp1jen89mchqqplvbrk5Z:/# 7za x kxm.zip -r -o./
7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz (50657),ASM,AES-NI)
Scanning the drive for archives:
1 file, 1886629888 bytes (1800 MiB)
Extracting archive: kxm.zip
ERRORS:
Unexpected end of archive
--
Path = kxm.zip
Type = zip
ERRORS:
Unexpected end of archive
Physical Size = 1886629888
Archives with Errors: 1
Open Errors: 1
You have new mail in /var/mail/root
root@iZbp1jen89mchqqplvbrk5Z:/# ls
1.txt data index.php kxm.zip report template vendor
application extend install_1584685405 login.php robots.txt template.bak weapp
core favicon.ico keximan123.tar.gz public sitemap.xml uploads 新手必读.url
7z命令的使用
解压缩7z文件
7za x test.zip -r -o./
参数含义:
- x 代表解压缩文件,并且是按原始目录树解压(还有个参数 e 也是解压缩文件,但其会将所有文件都解压到根下,而不是自己原有的文件夹下)
- test.zip 是当前目录下的压缩文件,这里用做测试文件
- -r 表示递归解压缩所有的子文件夹
- -o 是指定解压到的目录,-o后是没有空格的,直接接目录(-o./ 为当前目录)
压缩文件/文件夹
7za a -t7z -r test.7z /opt/test/*
参数含义:
- a 代表添加文件/文件夹到压缩包
- -t 是指定压缩类型,这里定为7z,可不指定,因为7za默认压缩类型就是7z
- -r 表示递归所有的子文件夹
- test.7z 是压缩好后的压缩包名
- /opt/test/* 是压缩目录
注意:7za不仅仅支持.7z压缩格式,还支持.zip.、tar、.bz2等压缩类型











网友评论