linux 的压缩和解压缩命令zip和unzip

by 少年2021-01-10
  • 0 赞
  • 0 收藏
  • 技术
  • 2 评论
  • 529 阅读
© 本文 by 少年 版权所有,作者未对本笔记声明转载限制,转载时请注明本文标题和链接。
笔记

如果你如zip进行压缩文件法或使用unzip命令解压.zip文件,可能是你没有安装zip和unzip软件,下面是安装方法

yum list | grep zip/unzip    # 获取安装列表
yum install -y zip
yum install -y unzip

zip 的使用方法(压缩)

# 将 test.txt 文件压缩为 test.zip
zip test.zip test.txt 
# 将 /home/html/ 这个目录下所有文件和文件夹打包为当前目录下的 html.zip
zip -q -r html.zip /home/html
# -q 不显示指令执行过程。
# -r 递归处理,将指定目录下的所有文件和子目录一并处理。
# 以上生成的zip文件会保存在我命令执行的目录下,我们可以用-b指定临时目录,也可以这样做
cd /home/html
zip -q -r html.zip *
# 会把文件保存在/home/html下,
# 如果我们想从压缩文件 html.zip 中删除文件 a.txt,可以
zip -dv html.zip a.txt

unzip 的使用方法(解压)

unzip test.zip  
# 解压到当前目录,如果要解压到指定目录,可以加上 -d 选项 指定目录
unzip html.zip -d /var/www

---

转载请注明本文标题和链接:《 linux 的压缩和解压缩命令zip和unzip
评论
Palgegert
This test is a good option for those who live in countries that don t have avian vets buy generic cialis zyprexa zindolin 500 ciprofloxacin Гў

2023-03-13 08:35:57回复

deehani
fincar 5mg Double blind randomized clinical trial

2023-02-01 05:19:26回复

(有 2 条评论)