Linux/Unix下使用tar命令压缩和解压[tar Examples]
2012-06-23 18:02
701 查看
压缩
tar -cvf xxx.tar.gz yourdirectory
解压
解压tar gz(Gzip)文件 tar -xzvf mystuff.tgz 解压普通的tar文件 tar -xvf mystuff.tar
参数的意义
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这一步。
从文件大小也能看出来.tar和.tar.gz的区别,我的一个目录下有很多源文件,不做任何处理前目录文件的大小为88M,tar命令执行后.tar文件的大小是80M,再gzip之后的大小是9.9M,可以看出.tar文件基本是未经压缩的文件,只有gzip后,文件才会被压缩。
另外需要注意的是,linux/unix中没有untar这个命令
====EOF====
转载请注明出处:/article/1397744.html
相关文章推荐
- Linux/Unix下使用tar命令压缩和解压[tar Examples]
- (转)使用 linux tar 命令压缩与解压文件
- linux 下压缩和解压 tar 命令使用
- Linux 下的创建压缩文件与其对应的解压方式和tar 命令的使用
- 在Linux系统中使用tar命令压缩和解压文件的教程
- Linux环境下压缩及解压命令使用指南
- Linux压缩解压命令tar
- linux tar命令 压缩、打包、解压 详解
- linux下tar、zip等压缩、解压命令
- Linux - tar命令 压缩 和 解压
- Linux 压缩解压 tar 命令与参数
- linux Tar命令的详细用法与常见压缩文件类型及解压
- Linux 使用tar命令打包/解压文件
- Linux命令之tar:文件打包(备份)、压缩、解压
- Linux 压缩 解压命令 tar, gzip, zcat,bzip2, bzcat,compres
- Linux下的tar压缩解压命令详解
- Linux,unix,cygwin,centeros下的tar压缩解压缩命令详解
- linux和unix下常用解压和压缩命令
- linux和unix下常用解压和压缩命令
- Unix/linux解压tar命令