Saturday, December 14, 2013

Commands on File Compression and Decompression

zip

zip -r foo.zip [directory]
unzip foo.zip

tar

tar -cvf foo.tar [directory]
tar -xvf foo.tar

tar.gz

tar -zcvf foo.tar.gz [directory]
tar -zxvf foo.tar.gz
tar -zxvf foo.tar.gz -C [directory]

.bz2

tar -jcvf foo.tar.bz2 [directory]
tar -xvjpf foo.tar.bz2