Uncompress for Different Formats
Ah, file uncompression! Always having to remember that “-xjvfirhfidopgnfudjs” command! Not so easy, right? So here’s a little reminder:
Before anything else, if you don’t know what a file contains: file <filename>
This command displays the file type based on its content, not its extension! (This information is based on the /etc/magic
file)
RPM Files
- Extract an rpm:
rpm2cpio <file.rpm> | cpio -mid
rpm2cpio belongs to the “rpm” package
cpio belongs to the “cpio” package
DEB Files
- Extract a deb:
ar xv <file.deb>
ar belongs to the binutils package
ZIP Files
- Extract a zip:
unzip <file.zip>
unzip belongs to the infozip package
Microsoft CAB Files
- Extract a Microsoft cab:
cabextract <file.cab>
cabextract can be obtained from uklinux.net
InstallShield CAB Files
- Extract an InstallShield cab:
unshield <file.cab>
unshield can be obtained from synce.sourceforge.net
Note: InstallShield cab files are usually named data1.cab, data1.hdr, data2.cab, etc.
ARJ Files
- Extract an arj:
unarj x <file.arj>
unarj belongs to the “bin” package, and a complete version of arj can be obtained from arj.sourceforge.net (in which case you would use “arj x” instead of “unarj x”)
RAR Files
- Extract a rar:
unrar x <file.rar>
unrar can be obtained from rarlab.com
ACE Files
- Extract an ace:
unace x <file.ace>
unace (“LinUnAce”) can be obtained from winace.com
LHA Files
- Extract a lha:
lha x <file.lha or file.lzh>
lha is available from its official site
JAR Files
- Extract a jar:
jar xvf <file.jar>
jar can be obtained from Sun’s JRE or JDK
Note: xpi files are actually jar files.
7z Files
- Extract a 7z:
7za x <file.7z>
7za can be obtained from the p7zip project page on Sourceforge.
For those who don’t know what 7z format is, take a look at the 7zip homepage, which is a free zip/7z archiver for Windows.
Common Formats
- Those that need no introduction:
Uncompress a Z file:
uncompress <file.Z>
Uncompress a gz file:
gzip -d <file.gz>
Uncompress a bz2 file:
bzip2 -d <file.bz2>
Extract a tar:
tar xvf <file.tar>
And the combinations…
Extract a tgz or tar.gz:
tar zxvf <file.tgz>
Extract a tar.bz2:
tar jxvf <file.tar.bz2>
Last updated 10 Oct 2006, 16:27 CEST.