博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zip压缩工具、tar打包、打包并压缩
阅读量:7126 次
发布时间:2019-06-28

本文共 1315 字,大约阅读时间需要 4 分钟。

 zip压缩工具

可以压缩目录和文件

打包:

[root@test ~]# zip 2.txt.zip 2.txt 

  adding: 2.txt (deflated 80%)

[root@test ~]# ls

2.txt  2.txt.zip  anaconda-ks.cfg  david.txt  get-pip.py  index.php  services  test  test.tar.gz

[root@test ~]# du -sh 2.txt.zip 

4.1M2.txt.zip

压缩:

[root@test ~]# unzip 2.txt.zip -d /tmp/

Archive:  2.txt.zip

  inflating: /tmp/2.txt              

[root@test ~]# ls /tmp/2.txt 

/tmp/2.txt

查看文件名

[root@test ~]# unzip -l 2.txt.zip 

Archive:  2.txt.zip

  Length      Date    Time    Name

---------  ---------- -----   ----

 21153962  10-31-2017 10:43   2.txt

---------                     -------

 21153962                     1 file

tar打包

可以压缩目录和文件

打包目录

[root@test ~]# tar zcvf test.tar.gz  test

test/

test/test-class4.html

test/test-class1.html

test/test-class3.html

test/test-class2.html

test/test-class5.html

解压:

[root@test ~]# tar xf test.tar.gz -C /tmp/

打包时不要哪些文件--exclude 选项

[root@test ~]# tar zcvf test.tar.gz --exclude test-class4.html --exclude test-class3.html test

test/

test/test-class1.html

test/test-class2.html

test/test-class5.html

查看压缩包内容:

[root@test ~]# tar tfv test.tar.gz 

drwxr-xr-x root/root         0 2017-09-09 07:46 test/

-rw-r--r-- root/root         0 2017-09-09 07:46 test/test-class4.html

-rw-r--r-- root/root         0 2017-09-09 07:46 test/test-class3.html

-rw-r--r-- root/root         0 2017-09-09 07:46 test/test-class5.html

本文转自方向对了,就不怕路远了!51CTO博客,原文链接: http://blog.51cto.com/jacksoner/1977716,如需转载请自行联系原作者
你可能感兴趣的文章
小程序环境搭建与开发工具的简单介绍
查看>>
我的友情链接
查看>>
red hat5安装mysql5.5.25
查看>>
深入理解C++的动态绑定和静态绑定
查看>>
cisco 7200 simulator
查看>>
JAVA WEB搭建 SpringMVC+Spring+hibernate 框架
查看>>
HibernateTemplate中常用的方法
查看>>
clang: error: unknown argument: 'websockets'解决方法
查看>>
Vue.js 特有的一种ajax——axios
查看>>
我的友情链接
查看>>
dos2unix命令 - 将DOS格式文本文件转换成UNIX格式
查看>>
灰度发布
查看>>
我的友情链接
查看>>
PHP中curl错误号对照表
查看>>
我的学习笔记之js
查看>>
【转】亂數產生器:Random 與 RNGCryptoServiceProvider
查看>>
iptables基本概念深入理解
查看>>
smarty前端常用标签
查看>>
Javascript数组小结
查看>>
我的友情链接
查看>>