Unix programmers have a long lasting tradition of sharing and exchanging source codes. An important number of tools and application are commonly published under Free Software and/or Open Source licenses, making the necessity to develop some conventions and standards in publishing source code.
Source code is generally distributed as a compressed tar archive. The most common compression method are gzip and bzip2 (a slower but more effective compression algorithm). The packaged archives are referred to as tarballs. Commonly, here are the filename extension used in naming conventions:
.tgzsignaling gzip compression
.tb2signaling bzip2 compression.
Here's how to extract the source code from the tarball:
tar xvzf foo.tar.gz tar xvjf foo.tar.bz2
gzcat foo.tar.gz | tar xv bzcat foo.tbz2 | tar xv
A common case: Autotools
The GNU build system (sometimes referred to as
autotools, because it includes
automake) is by far the most common format of
Unix-source packages. Here's the most basic use-case to install an
package from source:
configure script will detect the tools installed in the user's environment
and will generate the Makefile (and other scripts) accordingly. The option
--prefix=/path will define the target install directory (if nothing is
specified it will use
/usr/local by default). More options may be available
and can generally be consulted with
This command will compile the code into binaries by calling the make tool. It can optionally take specific targets as arguments and/or options.
This command will install the compiled code into the target directory (
/usr/localby default). Depending on the user's permission on the directory, it may need to be executed with root permissions.
Publicly available Source Control systems
Another form of source code distribution is setting up a publicly available source repository. Some projects make the latest developments of the code available this way. For instance:
git clone http://url-to-git-repo
svn co http://url-to-svn-repo proj-trunk