文件打包和壓縮
**zip **
- 壓縮文件 zip -r -q -o 文件名 路徑
- 查看文件大小 du -h -d 0
shiyanlou:Code/ $ ls [16:49:03]
a a.sh a.zip back.sh blog
shiyanlou:Code/ $ zip -r -q -o blog.zip ~/Code/blog [16:49:04]
shiyanlou:Code/ $ du -h -d 0 ~/Code/blog |sort [16:52:46]
104M /home/shiyanlou/Code/blog
shiyanlou:Code/ $ du -h -d 0 ~/Code/* |sort [16:53:10]
104M /home/shiyanlou/Code/blog
34M /home/shiyanlou/Code/blog.zip
4.0K /home/shiyanlou/Code/a.sh
4.0K /home/shiyanlou/Code/a.zip
4.0K /home/shiyanlou/Code/back.sh
8.0K /home/shiyanlou/Code/a
shiyanlou:Code/ $
當前路徑 : ./
upzip
- 不解壓 查看文件內容
shiyanlou:Code/ $ unzip -l a.zip [16:46:17]
Archive: a.zip
Length Date Time Name
--------- ---------- ----- ----
84 2016-07-05 17:02 a.sh
--------- -------
84 1 file
- 解壓zip文件 到當前目錄
shiyanlou:Code/ $ ls [17:00:53]
a.sh a.zip back.sh blog blog.zip
shiyanlou:Code/ $ unzip a.zip -d a [17:00:54]
Archive: a.zip
inflating: a/a.sh
**tar **
- man tar的給出的實例的用法
- tar的實例 打包 ,查看打包后的結果
- tar 解壓縮 到創(chuàng)建的臨時文件目錄上
shiyanlou:~/ $ man tar |grep -A 7 EXAMPLES[9:51:34]
EXAMPLES
Create archive.tar from files foo and bar.
tar -cf archive.tar foo bar
List all files in archive.tar verbosely.
tar -tvf archive.tar
Extract all files from archive.tar.
tar -xf archive.tar
shiyanlou:~/ $ ls [9:52:12]
Code Desktop mybin pc5s tmp tmp.tar tmp.zip ??????
shiyanlou:~/ $ tar -zcf tmp.tar.gz ./[9:52:24]
shiyanlou:~/ $ du -h -d 0 ./*[9:55:11]
138M./Code
36K./Desktop
8.0K./mybin
4.7M./pc5s
7.0M./tmp
5.4M./tmp.tar
194M./tmp.tar.gz
3.4M./tmp.zip
35M./下載
-
下面是解壓的過程
實驗樓
交作業(yè)
aafire 火爐實驗,多么大的火焰啊,可惜現(xiàn)在是夏天,烤的我好熱?。?/strong>
實驗樓
友情提示
我正在實驗樓擼代碼,你也快來!800+編程實戰(zhàn)教程,無需搭環(huán)境,直接練習!用我的鏈接注冊,你我都能獲得3個實驗豆!http://www.shiyanlou.com/register?inviter=NTY0MzE5MTkxNzAx