格式 :
zip
gz
bzip2
tar
工具 :
zip
zip hello.c 壓縮單個(gè)文件
unzip hello.c.zip 解壓
zip -r hello 壓縮目錄
zip hello.zip 解壓
gzip
gzip hello.c 壓縮單個(gè)文件
gzip -d hello.c.gz 解壓
gzip -c hello.c 將壓縮得到的文件輸出到標(biāo)準(zhǔn)輸出流
bzip2
bzip hello.c 壓縮單個(gè)文件
bzip -d hello.c.bz2 解壓
bzip -c hello.c 將壓縮得到的文件輸出到標(biāo)準(zhǔn)輸出流
tar 將一個(gè)文件或者一個(gè)目錄打包成一個(gè)單獨(dú)的文件
(可以解決gzip
和bzip2
不能打包目錄的缺陷)
tar -cf archive.tar foo bar
# Create archive.tar from files foo and bar.
tar -tvf archive.tar
# List all files in archive.tar verbosely. 這里v表示顯示詳細(xì)輸出
tar -xf archive.tar
# Extract all files from archive.tar.
tar -zcvf hello.tar.gz hello
這里c表示壓縮 , z表示壓縮成gz格式
tar -zxvf hello.tar.gz
這里x表示解壓 , z表示解壓gz格式的壓縮包
tar -jcvf hello.tar.gz hello
這里c表示壓縮 , j表示壓縮成gz格式
tar -jxvf hello.tar.gz
這里x表示解壓 , j表示解壓gz格式的壓縮包