文件打包与解压缩

一、知识储备

  • windows常用压缩文件:
    • *.zipzip程序打包压缩的文件
    • *.rar
    • *.7z
  • Linux常见:
    • *.gz,*.xz,*.bz2,
    • *.tartar程序打包,未压缩
    • *.tar.gztar打包,gzip压缩,
    • *.tar.xz,*.tar.bz2

二、命令学习

1.zip:

* 打包:zip something.zip something(目录加-r)
* 解包:unzip something
* 指定路径:-d

2.tar:

$ tar --help // 帮助中有实例
$ tar -cf shiyanlou.tar ~ // 打包
$ tar -xf shiyanlou.tar // 解包
$ tar -xf shiyanlou.tar -C tardir //解压到tardir目录 -C参数
$ tar -tf shiyanlou.tar // 仅查看包
$ tar -cphf etc.tar /etc //备份(-p 保留文件属性;-h 备份链接指向源文件)
$ 
$ tar -czf shiyanlou.tar.gz ~ // 使用gzip压缩文件
$ tar -xzf shiyanlou.tar.gz // 解压

3.rar

安装 rarunrar

$ sudo apt-get update
$ sudo apt-get install rar unrar

rar 命令参数没有 -

$ rar a shiyanlou.rar // a 参数
$ rar d shiyanlou.rar .zshrc //压缩
$ rar l shiyanlou.rar .zshrc // 查看不接呀
$ 
$ unrar x shiyanlou.rar //全路径解压
$ unrar e shiyanlou.rar tmp/  //解压到指定路径
posted @ 2017-06-25 18:23  小鸣Cycling  阅读(255)  评论(0编辑  收藏  举报