Tuesday, August 30, 2011

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 -"