1. 程式人生 > >Linux下壓縮與解壓

Linux下壓縮與解壓

zip壓縮解壓

壓縮:

zip -r dist.zip dist/*

解壓:

unzip dist.zip
unzip -o dist.zip // 在不提示的情況下覆蓋檔案
unzip -o -d ~/Desktop/temp // -d指定解壓目錄

tar壓縮解壓

tar命令解釋:

  • -c: 建立壓縮檔案
  • -x: 解壓
  • -t: 檢視內容
  • -r: 向壓縮檔案末尾追加檔案
  • -u: 更新原壓縮包中的檔案
  • -f: 使用文件名,-f引數是必須的,只能方法所有引數的最後
  • -z: 使用gzip的方式壓縮/解壓檔案
  • -v: 詳細報告tar處理的檔案資訊

一般常用命令:

tar -zcvf temp.tar.gz temp/*
tar -zxvf temp.tar.gz