Linux – Edit Software Package Source File

You use the following command on a Linux machine to install software packages:

sudo apt-get install <package-name>

Or you use some GUI-based tool for example the “Software Center” on Ubuntu if you have installed a desktop environment on your machine.

In any case, the machine needs to know where to look for packages to install them.

On Linux Debian Jessie or Ubuntu 16.04 Desktop, the path is,


The file sources.list stores all the sources that the machine is supposed to look in when you command the machine to install new software packages. The file on my Debian test machine looks like the following:


# deb cdrom:[Debian GNU/Linux 8.7.1 _Jessie_ - Official amd64 DVD Binary-1 20170116-11:01]/ jessie contrib main

deb cdrom:[Debian GNU/Linux 8.7.1 _Jessie_ - Official amd64 DVD Binary-1 20170116-11:01]/ jessie contrib main

deb jessie main
deb-src jessie main

deb jessie/updates main contrib
deb-src jessie/updates main contrib

# jessie-updates, previously known as 'volatile'
deb jessie-updates main contrib
deb-src jessie-updates main contrib

You can open this file with any text editor installed on your machine. On Debian Jessie, you can find the text editor “leafpad” pre-installed on the machine.

The following shows the same file but this time from an Ubuntu 16.04 machine:

 #deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted

# See for how to upgrade to
# newer versions of the distribution.
deb xenial main restricted
# deb-src xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb xenial-updates main restricted
# deb-src xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb xenial universe
# deb-src xenial universe
deb xenial-updates universe
# deb-src xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb xenial multiverse
# deb-src xenial multiverse
deb xenial-updates multiverse
# deb-src xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb xenial-backports main restricted universe multiverse
# deb-src xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb xenial partner
# deb-src xenial partner

deb xenial-security main restricted
# deb-src xenial-security main restricted
deb xenial-security universe
# deb-src xenial-security universe
deb xenial-security multiverse
# deb-src xenial-security multiverse

Let’s take a look at a sample line from the code above:

 deb cdrom:[Debian GNU/Linux 8.7.1 _Jessie_ - Official amd64 DVD Binary-1 20170116-11:01]/ jessie contrib main
  • This line starts with “deb”. It corresponds to binary packages that you can install with “apt”.
  • If you take a look at any of the files above, you’ll find lines starting with “deb-src”. Those lines correspond to source packages that you need to download first, compile yourself and then install.

The next part in the line above is the source:

cdrom:[Debian GNU/Linux 8.7.1 _Jessie_ - Official amd64 DVD Binary-1 20170116-11:01]/
  • Here you could find “cdrom”, “http”, “ftp” or “file” if you have a local repository.
  • In this case, the system has listed the install cd-rom with which the operating was first installed.

The next part in the main line above is the distribution name:


The next part in the main line above identifies what sort of packages you’re interested in:

contrib main

You could have the keywords “main”, “contrib”, “non-free”, “stable”, “unstable”, etc. Which one of these you should use depends on what you want to do. You usually find such information from the source whenever you need them. It’s not required to know them all by heart but just to understand their meaning or concept.

Installing Sofware Packages in Linux from the Command Line Interface

To install any software package from the command line interface in Linux, you need to have Super User rights first. That means, you are either logged in as the “root” user or you’re not “root” but your username in the system is a Super User. Once you’ve taken care of this, you can open a terminal on your machine and type the following command:

sudo apt-get install <package-name>

If you’re installing the Apache HTTP web server for instance, the command would be,

sudo apt-get install apache2
  • “apt-get install” is used in case of installing software packages in general.
  • “apache2” is the name of the the package in your repository. These names are usually the same in case of different Linux distributions but you usually can find out what the name is if you do a simple Google search or read your distribution’s documentation.

A repository is basically a place on the Internet where all such software packages are kept and maintained for your specific distribution of Linux. They build the application from the source code that they get from the software vendor, compile it specifically for your distribution and then keep it in the repository. Once you run the command mentioned above, the package will be downloaded from the repository and installed on the machine.

Sometimes, the software is on the DVD with which you installed the operating system. Especially in case of Debian, the installation media is way too big and contains almost everything, in terms of those software packages, that you might need. When you install the operating system, the system asks you to let the system scan all the media that you currently own related to the operating system and keeps a record of them. The operating system knows which package can be found on which media. For example, in case of Debian, the apache2 package is on the first DVD. So then if run the command mentioned above, the machine asks you to insert the first DVD and installs the software from the DVD rather than going to the Internet and downloading the package. It’s worth mentioning that when you want to install Debian, you don’t have to install all the DVDs that you find on and scan them all during the installation. The first one is enough. If you need anything else in the future, you could always go out to the Internet and download it.

Now when you run the command mentioned above, the following happens and is prompted to you in the terminal:

  • The system will read the package lists to make sure that it has the package you’re looking for. “Reading package lists… Done”
  • The system builds the dependency tree. This is a list of all the packages that are required for the package you’re trying to install. That means, the installation of your desired package depends on the existence of those dependency packages. If they’re not already present, they’ll be installed too.  “Building dependency tree”
  • “Reading state information… Done”
  • The system will inform you about the extra packages that need to be installed. “The following extra packages will be installed: <list-of-extra-packages>”
  • The system suggests some other packages that are usually installed along with the package you’re trying to install, or a list of packages that somehow go well with the desired package. For example, if you’re installing some sort of virtualization software, the system will suggest that you install the management console related to that software package as well so that you can manage it easily on a GUI. “Suggested packages: <list-of-suggested-packages>
  • The system will give you an overall report of what’s going to happen, for example how many packages are going to be upgraded, how many removed, how many installed, etc. “0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded”
  • The system will inform you about the size of the packages that it needs to get. “Need to get 0 B/1,942 kB of archives.”
  • The system will inform you about the additional disk space required for the whole operation. “After this operation, 6,643 kB of additional disk space will be used.”
  • The system will ask you if you want to continue. “Do you want to continue=[Y/n]”
  • Once you say, “Yes”, the system will ask you to insert the disk that came with the operating system, if you have scanned that disk before while you were installing the operating system. This way, you don’t have to download anything from the Internet. “Media change: please insert the disk labeled ‘Debian GNU/Linux 8.7.1 _Jessie_  – official amd64 DVD Binary-1 20170116-11:01’ in the drive ‘/media/cdrom/’ and press enter”
  • Once you insert the disk, the system will start to get the relevant packages from the DVD, unpack them and install them. Everything will be reported as it’s being done. You can always scroll up in your terminal to read about everything that happened during the installation. And your package is installed.

Linux File System Hierarchy Standard – History

Quoting, “The Filesystem Hierarchy Standard (FHS) defines the main directories and their contents in Linux and other Unix-like computer operating systems.”

The file system structure standardization for Linux started in 1993. It was called “FSSTND” which stands for “FileSystem Standard”. You’ll get the abbreviation if you put some of the letters in the phrase together.

The name of that standard (FSSTND) was later in 1996 changed to FHS after the BSD development community decided to help FSSTND become a standard that could standardize not only Linux but other Unix-like systems as well. FHS stands for “Filesystem Hierarchy Standard”.

Quoting, “the FHS is maintained by the Free Standards Group, a non-profit organization consisting of major software and hardware vendors such as HP, IBM and Dell.” Unquote.

Quoting, “The Free Standards Group was an industry non-profit consortium chartered to primarily specify and drive the adoption of open source standards. It was founded in 1998. On January 22, 2007, the Free Standards Group and the OSDL merged to form The Linux Foundation, narrowing their respective focuses to that of promoting Linux in competition with Microsoft Windows.” Unquote.

The proposed standard by the Free Standards Group (or later the Linux Foundation) is implemented in most flavors of Linux and not in some. You basically need to know how your own Linux distribution behaves when it comes to the file system structure and when you install applications on your distribution. For example, when you install applications/packages, the application goes into different paths in your file system by default if you don’t specify the path.