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

本文共 1310 字,大约阅读时间需要 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

本文转自 iekegz 51CTO博客,原文链接:http://blog.51cto.com/jacksoner/1977716,如需转载请自行联系原作者
你可能感兴趣的文章
C# 线程手册 第二章 .NET 中的线程
查看>>
Django实战(4):scaffold生成物分析
查看>>
复习一下Java中继承关系的类的初始化顺序
查看>>
mysql 导出查询结果到文件
查看>>
Windows Server 2008 R2安装Sql Server 2008 R2企业版出现错误:Could not open key
查看>>
测试过程
查看>>
修改默认的ajaxStart, ajaxStop 显示loading
查看>>
互联网创业的准备——web server:apache、nginx、lighttpd与php module、fastcgi
查看>>
HDU 3853 LOOPS(概率DP)
查看>>
在Android上使用XML
查看>>
异步消息的传递-回调机制(转)
查看>>
【OpenCV学习】图像的形态处理学
查看>>
深入学习GridBagLayout
查看>>
memcache实战之三 :客户端 enyim.com Memcached Client 的安装与调试以及实例,2012年下载地址...
查看>>
centos下安装tomcat
查看>>
Notification与NotificationManager
查看>>
Qt之布局管理--(2)多文档的布局和焦点
查看>>
go-tour练习解答
查看>>
句柄和指针的区别和联系是什么?
查看>>
linux Shell学习笔记第三天
查看>>