日期:2014-05-16  浏览次数:20591 次

Linux/Unix下使用tar命令压缩和解压[tar Examples]

压缩

解压


参数的意义

c Create a new archive.
t List the contents of an archive.
x Extract the contents of an archive.
f The archive file name is given on the command line (required whenever the tar output is going to a file)
M The archive can span multiple floppies.
v Print verbose output (list file names as they are processed).
u Add files to the archive if they are newer than the copy in the tar file.
z Compress or decompress files automatically.


tar,tar.gz/tgz

特别要注意的是,".tar"文件不是一个压缩过后的文件,它只是把所有文件集中在了一个文件里,这个文件时没有进行压缩过。而".tar.gz"或者".tgz"文件是被压缩过的。

如果你想对你的tar文件,进行压缩,那么你需要再运行gzip命令。所以如果你想直接压缩,最好在执行tar命令的时候,就加上"z"选项,这样就可以省去gzip这一步。


另外需要注意的是,linux/unix中没有untar这个命令

====EOF====

转载请注明出处:http://blog.csdn.net/pan_tian/article/details/7686408