I am Hack Sparrow
Captain of the Internets.

How to open tar.gz File in Linux

This post is a quick instruction on how to open tar.gz files in Linux.

So you came across a file that has the extension .tar.gz and have no idea how to open it. Let's say you downloaded node-v0.4.12.tar.gz, here's how you open it.

$ tar -zxvf node-v0.4.12.tar.gz
...
$ ls -la
drwxr-xr-x node-v0.4.12
-rw-rw-r-- node-v0.4.12.tar.gz

In the above example tar -zxvf will extract the contents of node-v0.4.12.tar.gz to a directory named node-v0.4.12. Do whatever you want to do with the contents.

tar.gz is actually a 'double-formatted' file type. The .tar part indicates that it's an archived file (multiple files bundled together), the .gz part indicates that it's a gzipped file (the files are compressed to decrease file size). Further details about the .tar and .gz can be found from the links at the references section.

The Linux tar command has got many more options, find out what they do. Type tar --help or man tar at the terminal.

References

  1. .tar file format
  2. GNU Tar
  3. .gz file format
  4. GNU Gzip

Make a Comment