Wednesday, September 10, 2008

Compress and uncompress the files in Linux with tar

To compress folder myfolder to myfolder.tar.gz

tar czfv myfolder.tar.gz myfolder/
czfv = "compress gzip file archive with verbose output"

If you want bzip files, use ‘j’ instead of ‘z’.

tar cjfv myfolder.tar.gz myfolder
cjfv = "compress bzip file archive with verbose output"


Uncompress myfolder.tar.gz to folder myfolder/

tar -xzf Test.tar.gz
xzf = ‘extract gzipped file archive’

Again, if you want bzip files, use ‘j’ instead of ‘z’.

tar -xzf Test.tar.gz
xjf = ‘extract bzipped file archive’

No comments: