How to edit/recover 'sources.list' file

Note:

By default you can find a backup of this file inside /etc/apt dir called sources.list.save

So you can use it to recover your lost one.

sudo cp /etc/apt/sources.list.save /etc/apt/sources.list

Else, if you don't have this file,you can visit this link:http://repogen.simplylinux.ch/ Enter your information and you'll get your customized sources.list file For the default set of repositories, you need to enable these repositories.

  1. All of the Ubuntu Branches repositories.
  2. Security - Important Security Updates.
  3. Security Sources Repository
  4. Updates - Recommended Updates
  5. Updates Sources Repository

Default sources.list file on 14.04:


# deb http://be.archive.ubuntu.com:80/ubuntu/ trusty main restricted

# deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates main restricted
# deb http://security.ubuntu.com/ubuntu trusty-security main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://be.archive.ubuntu.com:80/ubuntu/ trusty main restricted
deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates main restricted
deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-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 http://be.archive.ubuntu.com:80/ubuntu/ trusty universe
deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty universe
deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates universe
deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-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 http://be.archive.ubuntu.com:80/ubuntu/ trusty multiverse
deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty multiverse
deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates multiverse
deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-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 http://be.archive.ubuntu.com:80/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security 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 http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu trusty main
# deb-src http://extras.ubuntu.com/ubuntu trusty main

The location of the file is: /etc/apt/source.list

You can edit it by issuing sudo vi /etc/apt/source.list or sudo nano /etc/apt/source.list (nano might be easier for you).

If you want to add those repositories mentioned, you should add these lines to the bottom of the file:

# Tor Project Repositories
deb http://deb.torproject.org/torproject.org trusty main
deb-src http://deb.torproject.org/torproject.org trusty main