This is an old revision of the document!


Extract tar.gz, tar.bz2, zip, and Other Compressed Files

If the file is owned by root, you may need to use sudo.

tgz, tar.gz, tbz, tar.bz2, and tar.xz

To extract a tgz, tar.gz, tbz, tar.bz2, or tar.xz file, open the terminal and type

cd directory
tar -xvf filename

.bz2

bunzip2 filename.bz2

.gz

gunzip filename.gz

Note: Files such as tinycore.gz, tc-install.gz and nettools.gz, are different. See below.

.rar

unrar x filename.rar

.xz

unlzma filename.xz

.Z

uncompress filename.Z

.zip

unzip filename.zip

.7z

7z x filename.7z

Equivalent File Types

  .tgz is equivalent to .tar.gz
  .tbz and .tb2 are equivalent to .tar.bz2
  .taz is equivalent to .tar.Z
  .tlz is equivalent to .tar.lz
  .txz is equivalent to .tar.xz

tinycore.gz, tc-install.gz and nettools.gz

To extract files such as tinycore.gz, tc-install.gz and nettools.gz, use

cd directory
zcat tinycore.gz | sudo cpio -i -H newc -d

For more information, see Remastering.

.deb

To extract a .deb file, use

cd directory
ar vx filename.deb
tar -xzvf data.tar.gz

Another option is to use

cd directory
ar p filename.deb data.tar.gz | tar xz

.rpm

To extract an .rpm file, use

cd directory
rpm2cpio filename.rpm | cpio -vid
Print/export
QR Code
QR Code wiki:tar (generated for current page)