记住后缀名很重要,只有.tar.gz类似的压缩包才能被winzip解压缩,如使用tar命令生成.gz的压缩包,也是不能被winzip解压缩的。
-c, --create
create a new archive
-f, --file [HOSTNAME:]F
use archive file or device F (default "-", meaning stdin/stdout)
-j, --bzip2
filter archive through bzip2, use to decompress .bz2 files
-v, --verbose
verbosely list files processed
-z, --gzip, --ungzip
filter the archive through gzip
EXAMPLES
tar -xvf foo.tar --------- f必须放在最后面,然后接文件名verbosely extract foo.tar
tar -xzf foo.tar.gz
extract gzipped foo.tar.gz
tar -cjf foo.tar.bz2 bar/
create bzipped tar archive of the directory bar called foo.tar.bz2
tar -xjf foo.tar.bz2 -C bar/
extract bzipped foo.tar.bz2 after changing directory to bar
tar -xzf foo.tar.gz blah.txt
extract the file blah.txt from foo.tar.gz
不解压缩,只查看内容
tar -tf XXXX.tar.gz