Linux File Compression - TAR, GZIP, Z, LZMA Files

Written by:  • Edited by: J. F. Amprimoz
Updated Jul 6, 2011
• Related Guides: Graphical User Interface | Package Manager | Linux

There are many compression formats in the Linux world. Here we discuss the “tar-type” formats, covering tar.gz (tgz), tar.bz2 (tbz or tbz2 or tb2), .taz (tar.Z) and tlz (tar.lzma).

What is TAR? Why is it Used?

TAR is actually two things: a packaging file format and the program that handles these types of files. TAR is actually an acronym for “Tape ARchiver” and was first used to backup data to tape devices. In time, TAR has become the standard in the UNIX and Linux world as a de facto standard for the distribution and archiving of files.

TAR has a very important feature: it preserves file system information such as user and group permissions, date and time information and directory structures.

After you pack everything in a TAR file, you go on to compress it. The compression formats that are used with TAR are as follows:

  • GZip (GNU Zip): The files end with gz extension. With tar, they end with tar.gz or tgz.
  • BZip2: The files end with bz2 extension. With tar, they end with tar.bz2, tbz, tbz2 or tb2.
  • Z: Files are compressed with the compress command have a Z extension. If they are tar’red in advance, the extension becomes tar.Z.
  • LZMA (Lempel-Ziv-Markov chain Algorithm): The files which are compressed with LZMA have the lzma extension. If the files are tar’red before they are compressed, the file extension becomes tlz or tar.lzma.

How do I Open These Files?

The best way to open these files is through the command line, but many users shy away from typing commands. Most probably, you also will want to work with a program that has a Graphical User Interface (GUI).

At this point, 7-zip comes as a very handy program to work with compressed files, unfortunately you can only run it using Wine. You need to install p7zip and p7zip-full packages, and it is best to install these using your distribution’s package manager. When done, you can right click on the compressed file and select “Extract here” or double-click and open it with the Archive Manager and extract individual files. Usually Archive Manager can handle compressed files without any problems.

If you want to go with the command-line option, first navigate to the directory where you have saved the file with cd directory_name and then issue the relevant command:

  • Gzip files: gunzip file.gz or tar -zxvf filename.tar.gz (or filename.tgz) if the file is tar’red.
  • BZip2 files: bunzip2 filename.bz2 or tar -jxvf filename.tar.bz2 (or filename.tbz / filename.tbz2 / filename.tb2) if the file is tar’red.
  • Z files: you need to have ncompress package installed. If not, go and install it from your package manager. Then you can open the archive with uncompress filename.Z or if tar’red, tar -Zxvf filename.tar.Z. Be careful! The Z in the options is the capital Z!
  • LZMA files: You need to have lzma-utils package installed. You can install it from your distribution’s package manager. Then you can open the lzma file with unlzma -c filename.lzma. If the file extension is tar.lzma, then you can go for tar --lzma -xvf filename.tar.lzma or if the file is an old archive lzma -cd filename.tar.lzma | tar -xvf.

Comment

Showing all 1 comments
 
Greg Zeng Nov 12, 2009 11:03 AM
7ZIP works with PCLINUS OS
7Z is open source. It is on every PCLINUX OS distrubtion now. Howver it is not yet as good as the Windows version. You can't benchtest, which is now being used for reviews.

"7-zip compatible compression program
p7zip is a port of 7za.exe for Unix. 7-Zip is a file archiver with
highest compression ratio."

"Xarchiver, a lightweight archiving/compression tool
Xarchiver is a GTK+2 only frontend to 7z, zip, rar, tar, bzip2, gzip, arj,
lha, rpm and deb (open and extract only).Xarchiver allows you to create,
add, extract and delete files in the above formats. 7z, zip, rar, arj
password protected archives are supported."

"A CD/DVD image manipulator
- Mount automatically ISO, MDF, NRG, BIN, NRG
- A nice interactive display
- Convert2iso / Extract2folder: *.bin *.mdf *.nrg *.img *.daa *.cdi *.b5i *.bwi *.pdi and much more
- Play a DVD Movie Image inside Kaffeine / VLC with cover downloader
- Generate an ISO from a Folder or CD/DVD
- Generate / Check MD5 file of an image
- Encrypt / Decrypt an image
- Split / Merge image in X megabyte
- Compress with High Ratio an image in 7z format
- Rip a PSX cd to *.bin to make it work with epsxe/psx emulators
- Restore a lost CUE file of *.bin *.img
- Convert Mac OS *.dmg to a mountable image
- El-Torito support to create ISO bootable Cd
- Mount an image in a specified folder from the user
- Create a database of images
- Extract the Boot Image of a CD/DVD or ISO"


"Crack rar, zip, and 7z package passwords
If you forget your password for compressed archive (rar, 7z, zip),
this program is the solution.
This program uses bruteforce algorithm to find correct password. You
can specify wich characters will be used in password generations.
Warning: Please don't use this program for any illegal things!"
 
blog comments powered by Disqus
Email to a friend