Linux / UNIX command to open .gz files
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
OR
$ 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
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Unpacking or uncompressing gz files under Linux and UNIX systems
- How do I Compress a Whole Linux or UNIX Directory?
- How do I rotate log files?
- Grep compressed (.gz) files at a shell prompt
- vi / vim Auto complete File Name While Editing Files
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: compression_algorithms, data_compression, file_compression, gnu_tar, gunzip_command, gzip_command, gz_extension, gz_files, huffman_coding, Linux, lzw, tar_gz, UNIX



October 15th, 2007 at 1:30 pm
I can extract a .gz file using WinZip but how do I open a .gz file under Windows XP?