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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 12 comments… read them below or add one }
I can extract a .gz file using WinZip but how do I open a .gz file under Windows XP?
Sir,
I have some softwares downloaded from internet and few copied from Chip Magazine’s data dvds. I have dual-boot system[Windows xp home and ubuntu 8.10].I do not have much experience about computers and want to install few softwares which are in tar.gz formats and few are in tar.bz2 formats. I do not know how to install them-Only the deb or i386 formats are can be installed through Gdebi installer.Will you suggest me how to?
Nice blog!!
Keep it up!!
Really nice one-exactly the one needed.
It’s giving me following error :
====
root@server [/10gR2_db]# gzip -d 10201_database_linux_x86_64.cpio.gz
gzip: 10201_database_linux_x86_64.cpio.gz: unexpected end of file
root@server [/10gR2_db]
====
#mv 10201_database_linux_x86_64.cpio.gz 10201_database_linux_x86_64_cpio.gz
thank you for the help. really appreciate it.
tar: error i not recoverable : existing now …
this is the error m getting anyone have idea how do i resolve this
?
That was useful. Just a note: too often the compressed file has the extension .tar (not in gzip format). Then just use tar xvf file.tar
Many tx!
gunzip: configuration_files.tar.gz: unexpected end of file
if we need to gzip a folder and all the files inside the folder ,
gzip -d works ?
Is there any command in unix to extract .deflate files?