一、tar -zcvf /home/aaa.tar.gz /xahot
tar -zcvf 打包後生成的文件名全路徑 要打包的目錄
解壓 #tar -zxvf /usr/local/test.tar.gz
二、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 解壓bash