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:
1
rpm2cpio <file.rpm> | cpio -mid

rpm2cpio belongs to the “rpm” package
cpio belongs to the “cpio” package

DEB Files

  • Extract a deb:
1
ar xv <file.deb>

ar belongs to the binutils package

ZIP Files

  • Extract a zip:
1
unzip <file.zip>

unzip belongs to the infozip package

Microsoft CAB Files

  • Extract a Microsoft cab:
1
cabextract <file.cab>

cabextract can be obtained from uklinux.net

InstallShield CAB Files

  • Extract an InstallShield cab:
1
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:
1
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:
1
unrar x <file.rar>

unrar can be obtained from rarlab.com

ACE Files

  • Extract an ace:
1
unace x <file.ace>

unace (“LinUnAce”) can be obtained from winace.com

LHA Files

  • Extract a lha:
1
lha x <file.lha or file.lzh>

lha is available from its official site

JAR Files

  • Extract a jar:
1
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:
1
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:

1
uncompress <file.Z>

Uncompress a gz file:

1
gzip -d <file.gz>

Uncompress a bz2 file:

1
bzip2 -d <file.bz2>

Extract a tar:

1
tar xvf <file.tar>

And the combinations…

Extract a tgz or tar.gz:

1
tar zxvf <file.tgz>

Extract a tar.bz2:

1
tar jxvf <file.tar.bz2>

Last updated 10 Oct 2006, 16:27 CEST. history