How To Uncompress Linux Archive Files

Monday, November 21, 2011

Most of the time when you download files from Linux Software Directories, or when you get source code to compile, you end yourself with archive files that you need to uncompress.

In this article we will learn, or remember ourself, how to uncompress linux files compressed with the most common Linux file compression software: Gzip, Bzip and Xz.

Gzip, Bzip and Xz:

Gzip is certainly the most used Linux file compression software. Gzip is often used to compress files that have been put together with Tar. Most Unix operating systems make use of Gzip, or of similar programs based on the deflate compression algorithm.

NAME
       gzip, gunzip, zcat - compress or expand 
       .gz .tar.gz and .tgz files

SYNOPSIS
       gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ...  ]
       gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ...  ]
       zcat [ -fhLV ] [ name ...  ]

Bzip2 is a popular alternative to Gzip. People tend to prefer it over Gzip mainly because of its really efficient compression algorithm, and then its ability to produce smaller file archives.

NAME
       bzip2, bunzip2 - a block-sorting file compressor
       bzcat - decompresses files to stdout
       bzip2recover - recovers data from damaged bzip2 files

SYNOPSIS
       bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ...  ]
       bzip2 [ -h|--help ]
       bunzip2 [ -fkvsVL ] [ filenames ...  ]
       bunzip2 [ -h|--help ]
       bzcat [ -s ] [ filenames ...  ]
       bzcat [ -h|--help ]
       bzip2recover filename

Xz is becoming rather popular now-days. For example the official Gnome FTP software archive is now offering for download Xz compressed archives rather than Gzip ones.

NAME
       xz,  unxz,  xzcat,  lzma,  unlzma,  
       lzcat - Compress or decompress .xz and .lzma files

SYNOPSIS
       xz [option]...  [file]...

       unxz is equivalent to xz --decompress.
       xzcat is equivalent to xz --decompress --stdout.
       lzma is equivalent to xz --format=lzma.
       unlzma is equivalent to xz --format=lzma --decompress.
       lzcat is equivalent to xz --format=lzma --decompress --stdout.

And finally Zip, rarely used on Linux systems.

NAME
       zip - package and compress (archive) files
       unzip - list, test and extract compressed files in a ZIP archive

Identifying archive types by file extension

Looking at the extension of a linux archive is an easy way to identify the software that was used to compress it.

Gzip compressed file extensions:

  • .gz
  • .tar.gz
  • .tgz

Bzip compressed file extensions:

  • .bz2
  • .tar.bz2

Xz compressed file extensions:

  • .xz
  • .tar.xz

Uncompressing Gzip files

Use gunzip for single files...

        $ gunzip filename.gz       

or tar for archives (.tar.gz or .tgz)

        $ tar xvfz filename.tar.gz       

Options:

  • x: extract files from tar archive
  • v: verbosely list files processed ( may be omitted )
  • f: use archive file
  • z: use gunzip to uncompress archive -- this is the important one.

Uncompressing Bzip files

Use bunzip2 for single files...

        $ bunzip2 filename.gz       

or tar for archives (.tar.bz2)

        $ tar xvfj filename.tar.bz2       

Options:

  • x: extract files from tar archive
  • v: verbosely list files processed ( may be omitted )
  • f: use archive file
  • j: use bzip2 to uncompress archive -- notice: j is lowercase.

Uncompressing Xz files

Use xz for single files...

        $ xz --decompress filename.gz   

or tar for archives (.tar.xz)

        $ tar xvfJ filename.tar.xz       

Options:

  • J: use xz to uncompress archive -- notice: J is uppercase.

Uncompressing Zip files

This one is pretty obvious, you just need to use unzip:

        $ unzip filename.zip
Copyright © 2014 littleigloo.org - All rights reserved.

Leave Your Comment

Name :
Title :
Comment :
 
Nova FTP Client - Fast, modern and feature rich FTP Client for Window, Mac OS X and Linux
Favicon generator

Explorez toute l'actualité des mondes high-tech, formez-vous aux nouvelles technologies, téléchargez gratuitement les tout derniers logiciels et jeux
www.lestechmondes.com
Copyright © 1998-2014 littleigloo.org - All rights reserved . Last edited: November 19 2011 06:58:10. Privacy policy.
Nova FTP Client - Fast, modern and feature rich FTP Client for Window, Mac OS X and Linux