Linux下解压7z压缩包

## 前言

在linux中,通常是不支持7z压缩包的解压的,需要另行安装软件进行解压, p7zip 就是一款开源的解压缩软件(也是著名7-zip的linux移植版)

开始

Centos

1
yum install p7zip

Ubuntu/Debian等

1
apt install p7zip

其他

1
2
3
wget https://downloads.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2
tar -jxf p7zip_16.02_src_all.tar.bz2
bash install.sh

基本命令

压缩

1
7za a 压缩包.7z 被压缩文件或目录

解压

1
2
3
4
#将压缩包解压到指定目录,注意:指定目录参数-o后面不要有空格
7za x 压缩包.7z -o解压目录
#将压缩包解压到当前目录
7za x 压缩包.7z

结果示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
7za x  static.7z

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Xeon(R) CPU E5-26xx v4 (406F1),ASM,AES-NI)

Scanning the drive for archives:
1 file, 230486 bytes (226 KiB)

Extracting archive: static.7z
--
Path = static.7z
Type = 7z
Physical Size = 230486
Headers Size = 1904
Method = LZMA:19
Solid = +
Blocks = 1

Everything is Ok

Folders: 13
Files: 83
Size: 460818
Compressed: 230486