千家信息网

Linux中如何实现压缩和解压缩

发表于:2024-10-03 作者:千家信息网编辑
千家信息网最后更新 2024年10月03日,这篇文章主要介绍Linux中如何实现压缩和解压缩,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!一 常用的压缩格式.zip.gz.bz2.tar.gz.tar.bz2二 .zip
千家信息网最后更新 2024年10月03日Linux中如何实现压缩和解压缩

这篇文章主要介绍Linux中如何实现压缩和解压缩,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

一 常用的压缩格式

  • .zip

  • .gz

  • .bz2

  • .tar.gz

  • .tar.bz2

二 .zip格式压缩

1、语法

zip 压缩文件名 源文件名

压缩文件

zip -r 压缩文件名 源目录

压缩目录

unzip 压缩文件

解压缩.zip文件

2、说明

.zip的格式在windows和LInux是通用的。

3、实战

root@localhost test]# lsabc cdf[root@localhost test]# zip abc.zip abcadding: abc (stored 0%)[root@localhost test]# mkdir dirtst[root@localhost test]# touch ./dirtst/ert[root@localhost test]# zip -r dirtst.zip dirtstadding: dirtst/ (stored 0%)adding: dirtst/ert (stored 0%)[root@localhost test]# lsabc abc.zip cdf dirtst dirtst.zip[root@localhost test]# rm -fr abc[root@localhost test]# lsabc.zip cdf dirtst dirtst.zip[root@localhost test]# unzip abc.zipArchive: abc.zipextracting: abc[root@localhost test]# lsabc abc.zip cdf dirtst dirtst.zip[root@localhost test]# rm -rf dirtst[root@localhost test]# unzip dirtst.zipArchive: dirtst.zipcreating: dirtst/extracting: dirtst/ert[root@localhost test]# lsabc abc.zip cdf dirtst dirtst.zip

以上是"Linux中如何实现压缩和解压缩"这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!

0