Linux Unpack and Decompression Commands

Published: 01 Aug 2015 Category: linux_study

.tar

unpack: tar xvf FileName.tar
pack: tar cvf FileName.tar DirName

.gz

uncompress: gunzip FileName.gz
uncompress: gzip -d FileName.gz
compress: gzip FileName

.tar.gz, .tgz

uncompress: tar zxvf FileName.tar.gz
compress: tar zcvf FileName.tar.gz DirName

.bz2

uncompress: bzip2 -d FileName.bz2
uncompress: bunzip2 FileName.bz2
compress: bzip2 -z FileName

.tar.bz2

uncompress: tar jxvf FileName.tar.bz2
compress: tar jcvf FileName.tar.bz2 DirName

.bz

uncompress: bzip2 -d FileName.bz
uncompress: bunzip2 FileName.bz
compress: (unknown)

.tar.bz

uncompress: tar jxvf FileName.tar.bz
compress: (unknown)

.Z

uncompress FileName.Z
compress FileName

.tar.Z

uncompress: tar Zxvf FileName.tar.Z
compress: tar Zcvf FileName.tar.Z DirName

.zip

uncompress: unzip FileName.zip
compress: zip FileName.zip DirName

.rar

uncompress: rar x FileName.rar
compress: rar a FileName.rar DirName

.lha

uncompress: lha -e FileName.lha
compress: lha -a FileName.lha FileName

.rpm

unpack: rpm2cpio FileName.rpm | cpio -div

.deb

unpack: ar p FileName.deb data.tar.gz | tar zxf -

.tar .tgz .tar.gz .tar.Z .tar.bz .tar.bz2 .zip .cpio .rpm .deb .slp .arj .rar .ace .lha .lzh .lzx .lzs .arc .sda .sfx .lnx .zoo .cab .kar .cpt .pit .sit .sea

uncompress: sEx x FileName.*
compress: sEx a FileName.* FileName

uncompress .xz files

xz -d linux-3.12.tar.xz
tar -xf linux-3.12.tar
tar -Jxf linux-3.12.tar.xz