Thursday, 2 May 2013

Manipulating 'Tarball' Files in Linux

What are Tarball Files?

This question might arise to many users who download a program from the internet for the first time and do not want to install using terminal commands. On most websites, the possibility of the program as a 'tarball download' can be found alongside names such as RPM and Debian GNU packages. This is because those programs are best protected in a tar archive. Not only this, but resulting archive can also be downloaded quickly, as it is compressed. Post compression, a file with the extension tar.gz is emerged and this compressed archive is known as a tarball.

Extract Tarballs

To extract tarball files, following commands can be used:

tar xvzf file_name.tgz
tar xvzf file_name.tar.gztar jxf file_name.tbz2
tar jxf file_name.tar.bz2

-x stands for extract and it tells what to do with the input file.
-v stands for verbose and it lists all those files that are being unarchived. This field is optional
-z stands for zip and it tells tar to run file_name.tar.gz through gunzip first.
-f stands for file and it tells tar that the next string on the command line is the target file.

For example, if you want to extract project.tgz file, simple run-
tar xvzf project.tgz


To compile the file, change to the directory using cd command (see basic Linux commands here) where you have extracted the tarball and enter:

./configure installation_path


configure commands checks whether all the library files required to install the file are present or not. If certain library files are not present, it will show an error. Then you will have to add those missing libraries from repositories and repeat the procedure again.
make command converts source files to executable binaries.

Manual page for 'tar' here.


Tarball is widely used Linux and is a part of GNU project. Source code of most of the softwares are available in tar files. The file installation using its source code may be found difficult in early stages, but you may experience it pretty sophisticated once you get acquainted with it. It is very crucial to learn and understand the method of installation because some of the applications don't make available the package format for specific distros. Meanwhile, it also adds to your knowledge about organization of files in Linux and how their installation is done Linux. Tarball is nowadays supported by each and every Linux distro.


Post a Comment