2011年6月1日星期三

simple unix command - uncompress files

 #######################
tar is a compression technology used to create a Tape ARchive. The resulting file is known as a tarball.

If you have Window, this is the same as a Zip file. You use winzip to compress and uncompress .zip files.So its the same idea. To uncompress the files (or to get the files out of a tarball), you can use the following commands in linux.

tar xvf filename.tar

If the tarball has also been gzipped (compressed), you can use the following command:
tar xvfz filename.tar.gz

If you only want certain directories from the tarball, do this:
tar xvzf filename.tar.gz */dir.you.want/*

If you have a .tar.bz2 file, then you need bzip2 installed (/usr/ports/archivers/bzip2), and you issue this command:
tar yxf filename.tar.bz2

################
gunzip file.tar.gz
tar -xvf file.tar

Alternatively you can use one single command to do all the work:

tar -zxvf file.tar.gz

The -z basically does the gunzip work for you. Hope that helps.

http://www.ozzu.com/unix-linux-forum/how-unix-command-line-uncompress-tar-t69733.html

没有评论:

发表评论