Tar Extract a Single File(s) From a Large Tarball

Posted on in Categories , , , , , , , , , , , , , last updated December 6, 2008

Q. I’ve couple of large tarballs such as www.tar and images.tar. Is it possible to extract a single file or a list of files from a large tarball such as images.tar instead of extracting the entire tarball? How do I extract specific files under Linux / UNIX operating systems?

Linux / UNIX command to open .gz files

Posted on in Categories , , , , , , , , , last updated October 4, 2007

Q. I have download files from the Internet. Each file has .gz extension. How do I open .gz files under Linux?

A. You need to use gzip / gunzip program. It is a software application used for file compression. It is based on the DEFLATE algorithm, which is a combination of LZ77 and Huffman coding. DEFLATE was intended as a replacement for LZW and other patent-encumbered data compression algorithms

How do I extract a gz file?

Use guzip command as follows:
$ gunzip file.gz
$ gzip -d file.gz
To see new file, enter:
$ ls -l

How do I extract a tar.gz or .tgz file?

Files with extension tar.gz or .tgz are tar files compressed with gzip. On Unix system extract them with following command:
$ gunzip < file.tar.gz | tar xvf - $ gunzip < file.tgz | tar xvf -

If you have GNU tar (Linux system) you can use the z option directly:
$ tar xvzf file.tar.gz
$ tar xvzf file.tgz

Unpacking or uncompressing gz files under Linux and UNIX systems

Posted on in Categories , last updated January 17, 2008

Q. How do I open or uncompress .gz extension file under Linux or UNIX computer?

A. The .gz file extension are created using Gzip program which reduces the size of the named files using Lempel-Ziv coding (LZ77). gunzip / gzip is software application used for file compression. gzip is short for GNU zip; the program is a free software replacement for the compress program used in early Unix systems.

Each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modification times.

To expand i.e. to Unpacking or uncompressing gz files you need to use gunzip program Or gzip -d or zcat program:

Using gunzip command:
$ gunzip file.gz
$ ls file

Using gzip -d command:
$ gzip -d file.gz
$ ls file

If file extension is tar.gz, type the command:
$ tar -zxvf file.tar.gz
Please note that gunzip can currently decompress files created by gzip, zip, compress, compress -H or pack programs.

See also: