Linux下的压缩zip,解压缩unzip命令

2017-09-08   阅读:2914   分类:后端    标签: 服务器

Linux下的压缩zip,解压缩unzip命令

实例:压缩服务器上当前目录的内容为xxx.zip文件

zip -r xxx.zip ./*

解压zip文件到当前目录

unzip filename.zip

解压zip文件到指定目录

unzip ceshi.zip -d /wwwroot/ceshi/

[root@iZqslklrcu97jvZ ~]# cd /
[root@iZqslklrcu97jvZ /]# ls
aliyun-bin  boot  etc   lib         media  opt   root  sbin     srv  tmp  var
bin         dev   home  lost+found  mnt    proc  run   selinux  sys  usr  www
[root@iZqslklrcu97jvZ /]# cd /www/web/shop_tpxhm_top/public_html/
[root@iZqslklrcu97jvZ public_html]# ls
errpage  TPshop_20170828_v2.0.7  TP.zip
[root@iZqslklrcu97jvZ public_html]#unzip TP.zip
r-arguments.phpt  
  inflating: TPshop_20170828_v2.0.7/www/vendor/phpunit/phpunit/tests/TextUI/output-isolation.phpt  
  inflating: TPshop_20170828_v2.0.7/www/vendor/phpunit/phpunit/tests/TextUI/repeat.phpt  
  inflating: TPshop_20170828_v2.0.7/www/vendor/phpunit/phpunit/tests/TextUI/report-useless-tests-incomplete.phpt  
  inflating: TPshop_20170828_v2.0.7/www/vendor/phpunit/phpunit/tests/TextUI/report-useless-tests-isolation.phpt  
  inflating: TPshop_20170828_v2.0.7/www/vendor/phpunit/phpunit/tests/TextUI/report-useless-tests.phpt  
  inflating: TPshop_20170828_v2.0.7/www/vendor/phpunit/phpunit/tests/TextUI/tap.phpt  
  inflating: TPshop_20170828_v2.0.7/www/vendor/phpunit/phpunit/tests/TextUI/test-suffix-multiple.phpt  
  ......

压缩

  tar –cvf jpg.tar *.jpg //将目录里所有jpg文件打包成tar.jpg

  tar –czf jpg.tar.gz *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用gzip压缩,生成一个gzip压缩过的包,命名为jpg.tar.gz

  tar –cjf jpg.tar.bz2 *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用bzip2压缩,生成一个bzip2压缩过的包,命名为jpg.tar.bz2

  tar –cZf jpg.tar.Z *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用compress压缩,生成一个umcompress压缩过的包,命名为jpg.tar.Z

  rar a jpg.rar *.jpg //rar格式的压缩,需要先下载rar for linux

  zip jpg.zip *.jpg //zip格式的压缩,需要先下载zip for linux

  解压

  tar –xvf file.tar //解压 tar包

  tar -xzvf file.tar.gz //解压tar.gz

  tar -xjvf file.tar.bz2 //解压 tar.bz2

  tar –xZvf file.tar.Z //解压tar.Z

  unrar e file.rar //解压rar

  unzip file.zip //解压zip

  总结

  1、*.tar 用 tar –xvf 解压

  2、*.gz 用 gzip -d或者gunzip 解压

  3、*.tar.gz和*.tgz 用 tar –xzf 解压

  4、*.bz2 用 bzip2 -d或者用bunzip2 解压

  5、*.tar.bz2用tar –xjf 解压

  6、*.Z 用 uncompress 解压

  7、*.tar.Z 用tar –xZf 解压

  8、*.rar 用 unrar e解压

  9、*.zip 用 unzip 解压


【腾讯云】 爆款2核2G3M云服务器首年 61元,2核2G4M云服务器新老同享 99元/年,续费同价

‘简忆博客’微信公众号 扫码关注‘简忆博客’微信公众号,获取最新文章动态
转载:请说明文章出处“来源简忆博客”。http://tpxhm.com/adetail/17.html

×
觉得文章有用就打赏一下文章作者
微信扫一扫打赏 微信扫一扫打赏
支付宝扫一扫打赏 支付宝扫一扫打赏

文章评论(0)

登录
简忆博客壁纸一
简忆博客壁纸二
简忆博客壁纸三
简忆博客壁纸四
简忆博客壁纸五
简忆博客壁纸六
简忆博客壁纸七
简忆博客壁纸八
头像

简忆博客
勤于学习,乐于分享

置顶推荐

打赏本站

如果你觉得本站很棒,可以通过扫码支付打赏哦!
微信扫码:你说多少就多少~
微信扫码
支付宝扫码:你说多少就多少~
支付宝扫码
×