Linux常用指令(四)——压缩/解压缩工具

Linux压缩/解压缩工具

      • [4.1 zip压缩文件](#4.1 zip压缩文件)
      • [4.2 unzip解压缩文件](#4.2 unzip解压缩文件)
      • [4.3 tar压缩](#4.3 tar压缩)
      • [4.4 tar解压](#4.4 tar解压)

更加完整的Linux常用指令

压缩包文件格式

Windows: *.zip*.7z

Linux: *.zip*.7z**.rar*.gz*.xz*.bz2*.tar等等

4.1 zip压缩文件

bash 复制代码
# 使用zip打包文件夹test
# -r为递归打包包含子目录的全部内容,-q为安静模式,-o表示输出文件
cd /home/test
zip -r -q -o test.zip /home/mydir

# -e参数加密压缩
zip -r -e -o test.zip /home/mydir

4.2 unzip解压缩文件

bash 复制代码
# 解压到当前目录
unzip test.zip

# -q安静模式,解压到指定目录
unzip -q test.zip -d mydir

# 不解压只查看压缩包的内容
unzip -l test.zip

# 解压中文压缩包
unzip -O GBK 中文压缩文件.zip

4.3 tar压缩

bash 复制代码
# 打包test文件
# -P:保留绝对路径
# -c:创建一个tar包
# -f:指定创建文件名
cd /home/test
tar -P -cf test.tar /home/mydir

4.4 tar解压

bash 复制代码
# 解包一个文件(-x参数)到指定路径的已存在目录(-C参数)
mkdir mydir
tar -xf test.tar -C mydir

# -t参数,只查看不解包
tar -tf test.tar

# 解压*.tar.gz文件,-z参数
tar -xzf test.tar.gz
相关推荐
DLYSB_8 小时前
存储运维实战:基于 Ceph Event 监听与 Python 适配器的分布式存储健康度物理声光响应架构
运维·ceph·python·报警灯
爱丶狸8 小时前
Grafana_Zabbix_ImageRenderer_部署与前端操作手册
linux·前端·zabbix·grafana·kylin
阿里云云原生9 小时前
可用性从 99.9% 跃升至 99.995%:畅捷通如何用 AI 重塑运维底座?
运维·网络·人工智能
k4m7v2pz10 小时前
把 Bevy 0.14 游戏移植到 R36S 掌机:一场与“无窗口系统“的搏斗
linux·rust·bevy·r36s·rk3326·开源掌机
阿童木写作10 小时前
Python实现Temu图片批量翻译自动化教程
运维·人工智能·python·自动化
iori97king11 小时前
库存不足自动通知:第一次使用自动化
运维·自动化
@insist12311 小时前
信息系统管理工程师-信息系统运维资源、技术与智能运维核心考点解析
运维·软考·信管·软件水平考试·信息系统管理工程师
木子欢儿11 小时前
Intel 架构的 MacBook Pro 运行 Linux 发热量高解决
linux·运维·服务器
KKKlucifer13 小时前
运营商全域安全运维支撑体系落地实践
运维·安全
EAIReport14 小时前
工业电气自动化数据治理破局:多Agent大模型赋能全景智能决策
大数据·运维·自动化