压缩和解压
.gz gzip,gunzip
.bz2 bzip2,bunzip2
.xz xz,unxz
zip [-r] 备份文件.zip 被归档的文档...
-r:递归处理所有子文件
-d:更新压缩包内文件
-v:显示执行过程详细信息
[root@linuxcool ~]# ls /usr/bin/zip
[root@linuxcool ~]# zip -r File.zip /etc
adding: etc/fstab (deflated 45%)
adding: etc/crypttab (stored 0%)
adding: etc/resolv.conf (stored 0%)
adding: etc/dnf/ (stored 0%)
adding: etc/dnf/modules.d/ (stored 0%)
adding: etc/dnf/modules.d/container-tools.module (deflated 17%)
adding: etc/dnf/modules.d/llvm-toolset.module (deflated 14%)
………………省略部分输出信息………………
[root@linuxcool ~]# zip -r File.zip *.cfg
adding: anaconda-ks.cfg (deflated 44%)
adding: initial-setup-ks.cfg (deflated 44%)
[root@linuxcool ~]# zip -dv File.zip File.cfg
1>1: updating: File.cfg (deflated 44%)
unzip 备份文件.zip [-d 目标文件夹]
[root@linuxcool ~]# unzip -l File.zip #查看压缩包的内容
[root@linuxcool ~]# unzip File.zip
Archive: File.zip
creating: wordpress/
inflating: wordpress/xmlrpc.php
inflating: wordpress/wp-blog-header.php
…………省略部分输出信息…………
[root@linuxcool ~]# unzip File.zip -d /home
Archive: File.zip
creating: /home/wordpress/
inflating: /home/wordpress/xmlrpc.php
inflating: /home/wordpress/wp-blog-header.php
…………省略部分输出信息…………
[root@linuxcool ~]# unzip -t File.zip
Archive: File.zip
testing: wordpress/ OK
testing: wordpress/xmlrpc.php OK
…………省略部分输出信息…………