linux 文件压缩与解压
文件的压缩与解压,也是我们日常中经常用到的操作linux压缩,如,我们会经常从网上下载各种文件进行进行安装,而大部分文件都是经过压缩的。
下面来学习四个常用的压缩命令
文件压缩与解压 文件的压缩与解压,也是我们日常中经常用到的操作linux压缩,如,我们会经常从网上下载各种文件进行进行安装,而大部分文件都是经过压缩的。 下面来学习四个常用的压缩命令。 gzip 特点: 1.只能压缩文件,不能压缩目录 2.不保留源文件 [root@localhost test]# gzip aaa 将aaa文件进行压缩 [root@localhost test]# gunzip aaa.gz 将aaa.gz文件进行解压 [root@localhost test]# gzip -d aaa.gz 作用同上 tar tar类型的的压缩文件应该是大家最常见的吧,在网上下的好多软件也是这种格式的。 参数: -x解包.tar文件 -v 显示详细信息 -f 指定解压文件 -z 解压缩 [root@localhost test]# tar -zcvf tatga.tar.gz tatgz 压缩tatgz文件夹为tatga.tar.gz压缩文件 注意: 在linux下扩展名不是标识文件的属性 [root@localhost test]# file [文件名] 查看任何一个文件的类型 [root@localhost test]# tar -cf tatga.tar tatgz 对tatgz文件打包 [root@localhost test]# gzip tatga.tar 对tatga.tar包文件压缩 [root@localhost test]# tar -zxvf tatga.tar.gz 对压缩文件进行解压 zip 功能:可以压缩文件和目录,是windows 和linux 通用的压缩格式 [root@localhost test]# zip a.zip a 把a文件压缩成a.zip [root@localhost test]# zip -r tatgz.zip tatgz 压缩tatgz目录为tatgz.zip [root@localhost test]# unzip tatgz.zip 解压文件 bzip2 和gzip功能基本相同 只能压缩文件 用 -k 命令可以保留原文件 [root@localhost bzip2]# bzip2 -k fnngj 对fnngj文件进行压缩 [root@localhost bzip2]# bunzip2 fnngj.bz2 对压缩文件fnngj.bz2进行解压 (编辑:通辽站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |