Skip to the content.

Packages in Linux

Packaging involves usually 2 processes - archiving and compressing.

Archiving - tar tar is the name of the program used to collect many files into one larger file for distribution or archiving. It’s also a file format.

To create a archive,

$ tar -cf archive.tar 1.sh 2.sh $ ls 1.sh 5.sh Desktop echo Podcasts Videos 2.sh archive.tar details.out examples.desktop Public 3.sh 4.sh

To list the contents of archive,

$ tar -tvf archive.tar -rw-r–r– onie/egroup 473 2011-06-10 12:23 1.sh -rw-r–r– onie/egroup 357 2011-06-10 12:22 2.sh

To extract contents of archive,

$ tar -xf archive.tar $ ls | grep .sh 1.sh 2.sh

Compressing - gzip, bzip2, xz, lzip

Tar files are not compressed. A tar file when compressed is commonly referred to as a tarball.

Note that the size of archive is more than the combined sizes of 1.sh and 2.sh.

-rw-r–r– 1 onie egroup 473 2011-06-10 12:23 1.sh -rw-r–r– 1 onie egroup 357 2011-06-10 12:22 2.sh -rw-r–r– 1 onie egroup 10K 2011-06-15 13:40 archive.tar

For compressing we use any of the following compression utility tools

We will try using Gzip compression tool.

To compress,

$ gzip archive.tar Check the file’s size now, -rw-r–r– 1 onie egroup 523 2011-06-15 13:40 archive.tar.gz

To uncompress,

$ gzip -d archive.tar.gz or $gunzip archive.tar.gz

To install packages from source, read this tutorial: Install packages