Tuesday, March 18, 2008

tar and gzip/bzip on a single command on AIX

This command will be helpful when you do not have an option "z" for tar. In Linux you can directly specify "z" option in tar command but in AIX, you can not ....

To compress:

"tar cvf - abc | gzip > abc.tar.gz"

"tar cvf - abc | bzip2 > abc.tar.bz2"

To uncompress:

"gunzip < abc.tar.gz | tar xvf -"

"bzip2 < abc.tar.bz2 | tar xvf -"


Anonymous said...

To uncompress, it should be bunzip2

"bunzip2 < abc.tar.bz2 | tar xvf -"

Anonymous said...


Anonymous said...

Thanks....i never worked on AIX and now i'm in serious of this command..

RAHUL said...

Great help!

Anonymous said...

For various compression ratios using:

tar cvf - file1 file2 ... fileN | gzip -(1-9) > abc.tar.gz