linux 中解压7z文件

更新时间:2017-03-26 00:13:50

linux 解压、解压7z文件方法

安装7z源[root@VM_18_10_centos ~]# sudo yum install p7zip p7zip-plugins

Loaded plugins: fastestmirror, security

Setting up Install Process

Loading mirror speeds from cached hostfile

Package p7zip-16.02-2.el6.x86_64 already installed and latest version

Resolving Dependencies

--> Running transaction check

---> Package p7zip-plugins.x86_64 0:16.02-2.el6 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================

Package                   Arch               Version                 Repository        Size

=============================================================================================

Installing:

p7zip-plugins             x86_64             16.02-2.el6             epel             982 k

Transaction Summary

=============================================================================================

Install       1 Package(s)

Total download size: 982 k

Installed size: 2.7 M

Is this ok [y/N]: y

Downloading Packages:

p7zip-plugins-16.02-2.el6.x86_64.rpm                                  | 982 kB     00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : p7zip-plugins-16.02-2.el6.x86_64                                          1/1

Verifying  : p7zip-plugins-16.02-2.el6.x86_64                                          1/1

Installed:

p7zip-plugins.x86_64 0:16.02-2.el6

Complete!

[root@VM_18_10_centos ~]#

查看一下程序使用说明[root@VM_18_10_centos ~]# 7z

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21

p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,1 CPU Intel(R) Xeon(R) CPU E5-26xx v2 (306E4),ASM,AES-NI)

Usage: 7z  [...]  [...]

[]

a : Add files to archive

b : Benchmark

d : Delete files from archive

e : Extract files from archive (without using directory names)

h : Calculate hash values for files

i : Show information about supported formats

l : List contents of archive

rn : Rename files in archive

t : Test integrity of archive

u : Update files to archive

x : eXtract files with full paths

-- : Stop switches parsing

-ai[r[-|0]]{@listfile|!wildcard} : Include archives

-ax[r[-|0]]{@listfile|!wildcard} : eXclude archives

-ao{a|s|t|u} : set Overwrite mode

-an : disable archive_name field

-bb[0-3] : set output log level

-bd : disable progress indicator

-bs{o|e|p}{0|1|2} : set output stream for output/error/progress line

-bt : show execution time statistics

-i[r[-|0]]{@listfile|!wildcard} : Include filenames

-m{Parameters} : set compression Method

-mmt[N] : set number of CPU threads

-o{Directory} : set Output directory

-p{Password} : set Password

-r[-|0] : Recurse subdirectories

-sa{a|e|s} : set Archive name mode

-scc{UTF-8|WIN|DOS} : set charset for for console input/output

-scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files

-scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands

-sdel : delete files after compression

-seml[.] : send archive by email

-sfx[{name}] : Create SFX archive

-si[{name}] : read data from stdin

-slp : set Large Pages mode

-slt : show technical information for l (List) command

-snh : store hard links as links

-snl : store symbolic links as links

-sni : store NT security information

-sns[-] : store NTFS alternate streams

-so : write data to stdout

-spd : disable wildcard matching for file names

-spe : eliminate duplication of root folder for extract command

-spf : use fully qualified file paths

-ssc[-] : set sensitive case mode

-ssw : compress shared files

-stl : set archive timestamp from the most recently modified file

-stm{HexMask} : set CPU thread affinity mask (hexadecimal number)

-stx{Type} : exclude archive type

-t{Type} : Set type of archive

-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options

-v{Size}[b|k|m|g] : Create volumes

-w[{path}] : assign Work directory. Empty path means a temporary directory

-x[r[-|0]]{@listfile|!wildcard} : eXclude filenames

-y : assume Yes on all queries

[root@VM_18_10_centos ~]#

7z命令解压文件的例子:

7z x "/2017-03-03-uploads.7z" -y -aoa -o/11

解压2017-03-03-uploads.7z文件到目录/11。

7z x "/2017-03-03-uploads.7z" -y -aoa -o/11

参数说明:

x:完整路径下解压文件

-y:所有确认选项都默认为是(即不出现确认提示)

-aoa:直接覆盖现有文件,而没有任何提示。

-o:设置输出目录[root@izp0w0bp7w7vul720hq98lz /]# 7z x "/2017-03-03-uploads.7z" -y -aoa -o/11

7-Zip [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,2 CPUs Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz (406F1),ASM,AES-NI)

Scanning the drive for archives:

1 file, 9218952819 bytes (8792 MiB)

Extracting archive: /2017-03-03-uploads.7z

--

Path = /2017-03-03-uploads.7z

Type = 7z

Physical Size = 9218952819

Headers Size = 1784480

Method = LZMA2:24

Solid = +

Blocks = 5

Everything is Ok

Folders: 2905

Files: 140185

Size:       10296563719

Compressed: 9218952819

[root@izp0w0bp7w7vul720hq98lz /]#

-t7z -- 压缩文件的格式为7z

-mx=9 -ms=200m -mf -mhc -mhcf -m0=LZMA:a=2:d=25:mf=bt4b:fb=64 -mmt

-- 指定压缩算法选项

-mx=9 -- 设置压缩等级为极限压缩(默认为:LZMA 最大算法、32 MB 字典大小、BT4b Match finder、单词大小为 64、BCJ2 过滤器)

-ms=200m -- 开启固实模式,设置固实数据流大小为200MB。

-mf -- 开启可执行文件压缩过滤器。

-mhc -- 开启档案文件头压缩。

-mhcf -- 开启档案文件头完全压缩。我所使用的7z版本为4.42>2.30。

-m0=LZMA:a=2:d=25:mf=bt4b:fb=64

-- 第一个备选压缩算法为LZMA,压缩等级为最大压缩,LZMA算法使用的字典大小为25(2MB的5次方)32MB,算法的匹配器为bt4b(所需要内存为d×9.5 + 34 MB),压缩算法的紧凑字节为最大模式的64字节。

-mmt -- 开启多线程模式。

-r-- 递归到所有的子目录。

7z命令压缩文件的例子:

7z a -t7z /huoniao-2017-03-26.7z /huoniao/ -mhcf -mmt -r[root@VM_18_10_centos huoniao]# 7z a -t7z /huoniao-2017-03-26.7z /huoniao/ -mhcf -mmt -r

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21

p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,1 CPU Intel(R) Xeon(R) CPU E5-26xx v2 (306E4),ASM,AES-NI)

Scanning the drive:

4929 folders, 152256 files, 11032296754 bytes (11 GiB)

Creating archive: /huoniao-2017-03-26.7z

Items to compress: 157185

Files read from disk: 152189

Archive size: 9688588793 bytes (9240 MiB)

Everything is Ok

[root@VM_18_10_centos huoniao]#

Connection closed by foreign host.

Disconnected from remote host(ikuman) at 10:43:14.

Type `help' to learn how to use Xshell prompt.

已经顺利压缩完成,主目录的文件名 huoniao-2017-03-26.7z[root@VM_18_10_centos /]# ll

total 9471004

dr-xr-xr-x.   2 root root       4096 Mar  3 12:37 bin

dr-xr-xr-x.   4 root root       4096 Mar  3 09:15 boot

drwxr-xr-x    2 root root       4096 Nov  9 11:57 data

drwxr-xr-x   16 root root       3380 Mar  3 16:34 dev

drwxr-xr-x.  73 root root       4096 Mar  3 16:34 etc

drwxrwxrwx    2 root root       4096 Mar  3 15:12 hnbak

drwxr-xr-x.   2 root root       4096 Sep 23  2011 home

drwxrwxrwx    3 root root       4096 Mar 26 10:53 huoniao

-rw-r--r--    1 root root 9688588793 Mar 26 02:51 huoniao-2017-03-26.7z

dr-xr-xr-x.  11 root root       4096 Mar  3 12:18 lib

dr-xr-xr-x.   9 root root      12288 Mar  3 12:19 lib64

drwx------.   2 root root      16384 Nov  9 11:45 lost+found

drwxr-xr-x.   2 root root       4096 Sep 23  2011 media

drwxr-xr-x.   2 root root       4096 Sep 23  2011 mnt

drwxr-xr-x.   3 root root       4096 Nov  9 11:48 opt

dr-xr-xr-x  132 root root          0 Mar  3 16:33 proc

dr-xr-x---.   3 root root       4096 Mar  3 09:20 root

dr-xr-xr-x.   2 root root      12288 Nov  9 11:48 sbin

drwxr-xr-x.   2 root root       4096 Nov  9 11:45 selinux

drwxr-xr-x.   2 root root       4096 Sep 23  2011 srv

drwxr-xr-x   13 root root          0 Mar  3 16:33 sys

drwxrwxrwt.   3 root root     118784 Mar 26 10:53 tmp

drwxr-xr-x.  14 root root       4096 Mar  3 12:42 usr

drwxr-xr-x.  19 root root       4096 Nov  9 11:48 var

drwxr-xr-x    5 root root       4096 Mar  3 12:38 www

[root@VM_18_10_centos /]#

7z命令排除文件夹的例子: 排除uploads、phpmailer两个文件夹

7z a -t7z /huoniao/20171003.7z /huoniao/web/aus168_com/public_html/ -mhcf -mmt -r -xr\!uploads -xr\!phpmailer

7z a -t7z /1.zip /www/ihuoniao.cn/ -mhcf -mmt -r -xr\!uploads -xr\!templates -xr0\!*.sql -xr\!backup

[root@iZp0w0bp7w7vul720hq98lZ public_html]# 7z a -t7z /huoniao/20171003.7z /huoniao/web/aus168_com/public_html/ -mhcf -mmt -r -xr\!uploads -xr\!phpmailer

7-Zip [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,2 CPUs Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz (406F1),ASM,AES-NI)

Scanning the drive:

1880 folders, 20289 files, 387211806 bytes (370 MiB)

Creating archive: /huoniao/20171003.7z

Items to compress: 22169

Files read from disk: 20240

Archive size: 198601206 bytes (190 MiB)

Everything is Ok

[root@iZp0w0bp7w7vul720hq98lZ public_html]#

[root@iZp0w0bp7w7vul720hq98lZ huoniao]# du -sh *

190M20171003.7z

159Mdb_web_data

6.5Gweb

11Gweb_2017-09-30

[root@iZp0w0bp7w7vul720hq98lZ huoniao]#

-v指定分卷大小

{Size}[b | k | m | g]

指定分卷大小,可以使用字节、KB(1 KB=1024 字节),MB(1 MB = 1024 KB)或 GB(1 GB = 1024 MB)。

如果您只指定了 {Size},7-zip 将把它视为字。

7z a a.7z *.txt -v10k -v15k -v2m : 创建 a.7z 分卷压缩档案。第一个分卷为 10 KB,第二个为 15 KB,剩下全部为 2 MB。

大于10G以上文件夹,分3G卷打包

7z a -t7z /kuman/www/huoniao_20190512.7z /kuman/www/wwwroot/26dj.com/ -mhcf -mmt -r -v3g[root@ecs-eedb ~]# 7z a -t7z /kuman/www/huoniao_20190512.7z /kuman/www/wwwroot/26dj.com/ -mhcf -mmt -r -v3g

7-Zip [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,8 CPUs Intel(R) Xeon(R) Gold 6278C CPU @ 2.60GHz (50657),ASM,AES-NI)

Scanning the drive:

11142 folders, 149375 files, 16325307459 bytes (16 GiB)

Creating archive: /kuman/www/huoniao_20190512.7z

Items to compress: 160517

Files read from disk: 148452

Archive size: 14621014941 bytes (14 GiB)

Everything is Ok

[root@ecs-eedb ~]#

教程结束 ~

linux解压7z文件,linux 中解压7z文件相关推荐

  1. linux 获取文件父目录权限,Linux 文件权限中,操作一个文件需要父目录的那些权限?...

    eudore:linux 文件权限中,操作一个文件需要父目录的那些权限? 是否需要检查每级目录?想找到一份完整规范正确的指导,自己在写检查 linux 用户文件权限的代码. 例如读取一个文件 /hom ...

  2. matlab打开bmp,Matlab 读取文件夹中所有的bmp文件

    将srcimg文件下的bmp文件转为jpg图像,存放在dstimg文件夹下 str = 'srcimg'; dst = 'dstimg'; file=dir([str,'\*.bmp']); :len ...

  3. 失物招领php_我的Mac上“失物招领”文件夹中的大型iNode文件是什么?

    失物招领php If you're trying to figure out what's taking up space on your Mac, you might stumble upon so ...

  4. Python判断两个文件夹中互相不同的文件有哪些、判断一个文件夹相对于另外一个文件夹缺少了哪些文件

    Python判断两个文件夹中互相不同的文件有哪些.判断一个文件夹相对于另外一个文件夹缺少了哪些文件 目录 Python判断两个文件夹中互相不同的文件有哪些.判断一个文件夹相对于另外一个文件夹缺少了哪些 ...

  5. git在已忽略文件夹中不忽略指定文件

    注意:结尾的星号不能去,去掉就无效了 1.在已忽略文件夹中不忽略指定文件夹 /node_modules/* !/node_modules/layer/ 2.在已忽略文件夹中不忽略指定文件 /node_ ...

  6. 批量替换一个文件中的文件名,例如将文件夹中s**_abnormal.jpg文件修改为s**_abnor.jpg

    文章涉及到StringAbout::开头的函数具体实现参考:string与Cstring字符串类型转换和其他操作总结 CProcessFile::开头的函数实现参考:文件读写操作工具类CProcess ...

  7. java压缩zip文件夹错误_Java将文件或者文件夹压缩成zip(修复文件夹中存在多个文件报Stream Closed错误问题)...

    项目场景: Java将文件或者文件夹压缩成zip(修复文件夹中存在多个文件报Stream Closed错误问题) 问题描述: 最近的项目需要将多级文件夹压缩成zip,网上找了几个工具类,都会报错,所以 ...

  8. 使用cmd命令在桌面上新建一个文件夹,且在文件夹中新建一个.java文件,使用cmd命令实现.java文件的编译运行

    标题使用cmd命令在桌面上新建一个文件夹,且在文件夹中新建一个.java文件,使用cmd命令实现.java文件的编译运行 1.在电脑桌面使用快捷键win+r打开 2.打开cmd命令界面之后使用md d ...

  9. 在Linux和Windows下删除文件夹中包含的.svn文件的方法

    为什么80%的码农都做不了架构师?>>>    一.在linux下 删除这些目录是很简单的,命令如下 find . -type d -name ".svn"|xa ...

  10. centos查找linux大文件,centos中查找出大文件命令汇总

    在linux中简单的查找文件与目录大小很简单 #已易读的格式显示指定目录或文件的大小,-s选项指定对于目录不详细显示每个子目录或文件的大小 du -sh [dirname|filename] 如: 当 ...

最新文章

  1. P1505 [国家集训队]旅游 树链剖分
  2. quick-cocos2d-x教程12:实现文本和password输入界面
  3. Struts2的类型转换(下)
  4. caffe学习笔记18-image1000test200数据集分类与检索完整过程
  5. mysql日期格式转化
  6. 细说ASP.NET Core与OWIN的关系
  7. 继续教育计算机组成原理a试卷,计算机组成原理模拟试题及答案西工大.doc
  8. aio 系统原理 Java_Java新一代网络编程模型AIO原理及Linux系统AIO介绍
  9. C语言——二维数组转置
  10. 学习阶段怎么模拟_掌握学习方法,早日取得执业药师证
  11. SiFive募集1.75亿美元融资 计划2024年上市
  12. python LDA实践入门学习
  13. 数字图像处理 matlab 傅里叶变换及逆变换 余弦变换及逆变换(使用代码库)
  14. Centos7 下配置mail使用163邮箱发送邮件
  15. vue项目 微信支付 和 支付宝支付
  16. 闪存颗粒-2D和3D闪存之间的区别和联系
  17. 针对有APP签名的系统中,短信不能收发的问题解决过程
  18. python开发魔塔(1)
  19. vue vant优惠券使用
  20. Java中的对象类型像引用还是指针,谁是谁非?

热门文章

  1. css3中-moz、-ms、-webkit、-o 各是什么意思
  2. 条件概率下的全概率公式
  3. HTPPS的域名部署项目请求头xx_xx问题解决
  4. java lang arithmetic,java.lang.ArithmeticException
  5. matlab 图像处理 消除锯齿,Matlab图像处理,锯齿阵列图像
  6. 芝加哥犯罪率数据集(数据分析与特征处理)
  7. smith预估 matlab,毕业论文】大滞后系统Smith预估器的控制仿真
  8. 数据仓库指北(文末附PDF下载)
  9. 域内计算机本地管理员密码管理
  10. 计算机应用基础7次作业答案,北京中医药大学远程教育“计算机应用基础”第7次作业(14页)-原创力文档...