zip:打包和压缩文件
简介zip压缩格式是很多计算机平台通用的压缩格式。和gzip命令相比,zip命令压缩不仅不会删除源文件,而且还可以压缩目录
说明
zip压缩格式是很多计算机平台通用的压缩格式。和gzip命令相比,zip命令压缩不仅不会删除源文件,而且还可以压缩目录
格式
zip [option] [file]
常用参数
- -r:将指定目录下的所有文件和子目录一并压缩
- -x:压缩文件时排除某个文件
- -q:不显示压缩信息
示例
1、压缩文件
[root@localhost test]# cp /etc/services .
[root@localhost test]# ll -h services
-rw-r--r--. 1 root root 655K May 14 15:33 services
[root@localhost test]# zip services.zip ./services
adding: services (deflated 80%)
[root@localhost test]# ll -h services*
-rw-r--r--. 1 root root 655K May 14 15:33 services
-rw-r--r--. 1 root root 134K May 14 15:34 services.zip
2、压缩目录
[root@localhost ~]# zip test.zip ./test #不加-r参数将只会压缩目录这个额一个文件,所以这样使用不对
updating: test/ (stored 0%)
[root@localhost ~]# zip -r test.zip ./test #-r参数
adding: test/ (stored 0%)
adding: test/test_01.txt (stored 0%)
adding: test/test_02.txt (stored 0%)
adding: test/test_03.txt (stored 0%)
adding: test/test_04.txt (stored 0%)
adding: test/test_05.txt (stored 0%)
adding: test/test_06.txt (stored 0%)
adding: test/test_07.txt (stored 0%)
adding: test/test_08.txt (stored 0%)
adding: test/test_09.txt (stored 0%)
adding: test/test_10.txt (stored 0%)
adding: test/test_11.txt (stored 0%)
adding: test/test_12.txt (stored 0%)
adding: test/test.txt (stored 0%)
adding: test/services (deflated 80%)
adding: test/services.zip (stored 0%)
3、排除压缩文件
[root@localhost ~]# zip -r test.zip ./test -x test/services.zip test/services
updating: test/ (stored 0%)
updating: test/test_01.txt (stored 0%)
updating: test/test_02.txt (stored 0%)
updating: test/test_03.txt (stored 0%)
updating: test/test_04.txt (stored 0%)
updating: test/test_05.txt (stored 0%)
updating: test/test_06.txt (stored 0%)
updating: test/test_07.txt (stored 0%)
updating: test/test_08.txt (stored 0%)
updating: test/test_09.txt (stored 0%)
updating: test/test_10.txt (stored 0%)
updating: test/test_11.txt (stored 0%)
updating: test/test_12.txt (stored 0%)
updating: test/test.txt (stored 0%)
前一篇博客中已经说过Golang对Gzip的处理,其实这是我的服务器端的处理,那么当我们服务器返回Gzip压缩的字符串后,客户端如何进行解压呢?本文主要记录下JavaScript对Gzip进行压缩和解压处理。
在PHP中,对二维数组排序还是非常简单的,但是在Golang中对二位数据排序显的就稍显麻烦,但是我们还是可以通过结构体来进行排序,本文主要记录Golang如何通过结构体的多个字段来进行排序。
Python调用WPS把文档转换PDF,并把PDF转图片,首先需要安装WPS,然后利用pypiwin32把文档转化成PDF,再利用fitz、PyMuPD把PDF转化成图片
通过sudo命令,可以让普通用户在执行指定命令或程序上,拥有超级管理员的权限。并有针对性将不同的命令授予指定的普通用户,同时普通用户不需要知道root的密码就可以得到授权,授权的方式可以通过visudo配置管理。
快速生成表格
Electron页面跳转、浏览器打开链接和打开新窗口
在使用Git的过程中,不想每次都输入用户名和密码去拉取代码,所以就需要保存这些信息,那么既然有保存了,就必须有清除功能。
在Mac电脑中,如何对Git的用户名和密码进行修改呢?起初不懂Mac,所以整了很久,本文将记录如何对这个进行操作,以便后期使用。
Docker编译镜像出现:fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.2c4ac24e.tar.gz: No such file or directory问题