linux压缩与解压

1、tar -zcvf /home/aaa.tar.gz /xahot
tar -zcvf 打包后生成的文件名全路径 要打包的目录

解压 #tar -zxvf /usr/local/test.tar.gz

2、zip –r xahot.zip xahot
zip –r xahot.zip *
压缩当前的文件夹 zip -r ./xahot.zip ./* -r表示递归
zip [参数] [打包后的文件名] [打包的目录路径]

解压 unzip xahot.zip
将/home/wwwroot/xahot.zip解压到当前目录


如果出现这个提示:
-bash: zip: command not found 不能执行ZIP压缩,是因为没有安装ZIP,
运行下这条安装命令即可 yum install 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 解压

原文地址:https://www.cnblogs.com/supe/p/10147737.html