Monday, March 24, 2008

Compression and Uncompression of files in linux

Compress folder Test/ to Test.tar.gz

tar czfv Test.tar.gz Test/
czfv = ‘Compress Zip File Verbose’
If you want bzip files, use ‘j’ instead of ‘z’.


Uncompress Test.tar.gz to folder Test/

tar -xzf Test.tar.gz
x = ‘eXtract’
Again, if you want bzip files, use ‘j’ instead of ‘z’.


To compress a tar.bz2 file, use the command (note the j option)

Code:

tar -jcvf filename.tar.bz2

To extract a tar.bz2 file, use the command (note the j option)

Code:

tar -jxvf filename.tar.bz2

To extract a tar.gz file, the the command (note the z option)

Code:

tar -zxvf filename.tar.gz

No comments: