6.2 gzip:压缩或解压文件
gzip命令
把目录下的每个文件都压缩成单独的.gz文件
[root@cs6 html]# ls
10.html 1.html 2.html 3.html 4.html 5.html 6.html 7.html 8.html 9.html oldboy
[root@cs6 html]# gzip *.html
[root@cs6 html]# ls
10.html.gz 2.html.gz 4.html.gz 6.html.gz 8.html.gz oldboy
1.html.gz 3.html.gz 5.html.gz 7.html.gz 9.html.gz不解压显示上一个例子中每个压缩文件的信息。
[root@cs6 html]# gzip -l *.gzcompressed uncompressed ratio uncompressed_name28 0 0.0% 10.html27 0 0.0% 1.html27 0 0.0% 2.html27 0 0.0% 3.html27 0 0.0% 4.html27 0 0.0% 5.html27 0 0.0% 6.html27 0 0.0% 7.html27 0 0.0% 8.html27 0 0.0% 9.html
[root@cs6 html]# ls
10.html.gz 2.html.gz 4.html.gz 6.html.gz 8.html.gz oldboy
1.html.gz 3.html.gz 5.html.gz 7.html.gz 9.html.gz
解压文件,并显示解压过程
[root@cs6 html]# gzip -dv *.gz #<==使用-d参数解压文件,使用-v参数显示解压过程。
10.html.gz: 0.0% -- replaced with 10.html
1.html.gz: 0.0% -- replaced with 1.html
2.html.gz: 0.0% -- replaced with 2.html
3.html.gz: 0.0% -- replaced with 3.html
4.html.gz: 0.0% -- replaced with 4.html
5.html.gz: 0.0% -- replaced with 5.html
6.html.gz: 0.0% -- replaced with 6.html
7.html.gz: 0.0% -- replaced with 7.html
8.html.gz: 0.0% -- replaced with 8.html
9.html.gz: 0.0% -- replaced with 9.html
[root@cs6 html]# ls
10.html 1.html 2.html 3.html 4.html 5.html 6.html 7.html 8.html 9.html oldboy
[root@cs6 html]#
压缩解压保留源文件
[root@cs6 html]# cp /etc/services .
[root@cs6 html]# ll -h services
-rw-r--r--. 1 root root 626K May 13 00:29 services
[root@cs6 html]# gzip -c services >services.gz #<==使用-c 选项与输出重定向符号将输出定向到services.gz。
[root@cs6 html]# ll -h services*
-rw-r--r--. 1 root root 626K May 13 00:29 services
-rw-r--r--. 1 root root 125K May 13 00:30 services.gz #<==使用-d选项解压。
[root@cs6 html]# gzip -dc services.gz >services2
[root@cs6 html]# diff services services2 #<==对比源文件和解压后的文件,没有差别。
[root@cs6 html]# ll -h services*
-rw-r--r--. 1 root root 626K May 13 00:29 services
-rw-r--r--. 1 root root 626K May 13 00:31 services2
-rw-r--r--. 1 root root 125K May 13 00:30 services.gz
经验技巧
[root@cs6 html]# zcat services.gz |head
# /etc/services:
# $Id: services,v 1.48 2009/11/11 14:32:31 ovasik Exp $
#
# Network services, Internet style
# IANA services version: last updated 2009-11-10
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports
[root@cs6 html]# zcat services.gz >services #也可以直接解压出来重定向到文件。
[root@cs6 html]#
6.2 gzip:压缩或解压文件相关推荐
- Linux命令学习(4):gzip压缩与解压
版权声明:本文为博主原创文章,未经允许不得转载 引子 gzip是Linux系统中最常用也是高效的压缩压缩命令.早期Linux系统中主要使用compress命令压缩,得到后缀为".Z" ...
- 下载c语言软件后怎么解压,手机怎么解压文件 盘点常用手机压缩打包解压文件应用...
手机现在是我们必不可少的工具,在下载应用的时候,众多网站已经把安装文件独立好了等我们去下载,但是如果你要把文件打包或者下载了网络上已经被打包压缩好的文件需要解压缩的时候,就会觉得很麻烦了,手机上可没有 ...
- Linux中压缩和解压(gzip压缩/gunzip解压)(zip压缩/unzip解压)(tar打包解压)
文章目录 Linux中压缩和解压(gzip压缩/gunzip解压)(zip压缩/unzip解压)(tar打包解压) 一.gzip压缩 / gunzip解压 1.命令 2.注意 3.案例 4.常用 二. ...
- python遍历目录压缩文件夹_Python实现多级目录压缩与解压文件的方法
本文实例讲述了Python实现多级目录压缩与解压文件的方法.分享给大家供大家参考,具体如下: 咱向来就是拿来主意,也发个东西供同行"拿来"使用吧 咱信奉的就是少量的代码完成大量的工 ...
- 压缩,解压文件|*.tar.gz/.tar.bz2 文件
参考 Tar选项: c – 创建压缩文件 x – 解压文件 v – 显示进度 f – 文件名 t – 查看压缩文件内容 j – 通过bzip2归档 z –通过gzip归档 r – 在压缩文件中追加文件 ...
- 收集总结java中压缩、解压文件方法
1.使用GZIPOutputStream压缩文件: @org.junit.Testpublic void test013 (){String str = "F:\\MyTest\\myTes ...
- 使用Ionic.Zip压缩、分卷压缩、解压文件
分卷压缩使用方法: int iMinLength = 100;//最小压缩包单位(100M)ZipHelper.Compress("../../../xxx.xx", " ...
- python 压缩与解压文件
文件copy模块shutil 高级的文件.文件夹.压缩包处理模块 shutil.copyfileobj() 将文件内容拷贝到另一个文件中 shutil.copyfile() 拷贝文件 import s ...
- .net 压缩、解压文件
做web技术有时候要向客户返回一些文件如:excel.word.甚至是一些视频.音频等.但当数据量过大的时候,我们可能要考虑到用要用压缩(或者批量压缩)处理的方式把问价传送给客户端.下面介绍一种功能较 ...
最新文章
- LeetCode简单题之数组元素积的符号
- 实习生离职,HR恼羞成怒:我要全行业封杀你
- android动态添加标签,android – 动态添加Textview
- 用C#访问Hotmail -转
- 我的vscode配置 利用Settings Sync一键安装
- 数字(进制/二分/组合数学)
- 前端学习(1346):用户的增删改查操作3增加
- tcp实时传输kafka数据_tcp怎么传输大数据
- Java基础入门笔记-随机数
- c# webapi返回html,c#-从Web API 2端点返回自定义HTTP状态代码
- 如何使用JavaScript或JQuery检测一个URL文件是否存在?
- java中jtextpane_Java JTextPane
- mac上远程连接windows
- Azure角色管理技巧和工具
- PourOver – 快速筛选和排序大的数据集合
- 20155305乔磊2016-2017-2《Java程序设计》第七周学习总结
- Servlet 2.4 规范之第四篇:Servlet上下文
- ai俄罗斯方块java,C#实现俄罗斯方块AI
- Self-paced and auto-weighted multi-view clustering 阅读笔记
- Phaser2.0 tween动画
热门文章
- php分布式数据一致性,如何解决分布式系统数据事务一致性问题
- python输入文件名读取文件_[Python] python3 文件操作:从键盘输入、打开关闭文件、读取写入文件、重命名与删除文件等...
- android单选对话框代码,Android实现单选与多选对话框的代码
- cdt规约报文用程序解析_用Python运维网络(5):scapy
- 文件上传错误:Error setting expression 'uploadImage' with value '[Ljava.lang.String;@5ff8a691'...
- 刚刚,Python 3.10 正式发布了!我发现了一个可怕的功能...
- 移动并重命名2000个文件,Python,3秒
- 收藏 | 49 个 Python 学习资源
- 破云里步重华为什么说自己姓薛_都说虎毒不食子,但猫咪为什么会吃掉自己的孩子呢...
- bitnamigitlab_Bitnami Gitlab 安装配置 step by step