I want to backup all the repositories I added to the Ubuntu Software Center, but apparently sources.list contains only the ones which belong to Canonical.

So where do I find the other ones?


There's a directory, /etc/apt/sources.list.d/ that contains individual entries for each PPA you've added with add-apt-repository. Those are the files you need to back up.


Many people find it easier to back up and restore a single file rather than dealing with a directory of files (as the other mentioned solutions require). If you are like this, and you do not care about having each PPA stored in its own file inside of /etc/apt/sources.list.d/, you can use the following command to store all of your added repositories in a single file called sources.list located in your home directory.

cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list > ~/sources.list

You could then move this file to /etc/apt/sources.list and do sudo apt-get update to re-add the repositories. If you are planning to use this backup on another computer, make sure that the version of Ubuntu on the machine matches the versions in the sources.list file, otherwise, you might have some problems.


You could also use y-ppa-manager or you could use apt-clone to do that.

Here's a screenshot:
Y PPA Manager



I backup the complete /etc/apt directory. You can copy it back if you have to reinstall, or you can copy it to the same location on another machine with the same release version.


APT-Clone to Clone/Restore Packages on an Apt Based System.
It will save/restore the packages, sources.list, keyring and automatic-installed states. It can also save/restore no longer downloadable packages using dpkg-repack.

  1. Install

    sudo apt-get install apt-clone

  2. Make backup

    sudo apt-clone clone ~/path/to/apt-clone-state-ubuntu-$(lsb_release -sr)-$(date +%F).tar.gz

  3. Restore backup

    sudo apt-clone restore ~/path/to/apt-clone-state-ubuntu.tar.gz

    Restore to newer release:

    sudo apt-clone restore-new-distro ~/path/to/apt-clone-state-ubuntu.tar.gz $(lsb_release -sc)

FYI, APT-Clone is used by ubiquity (Ubuntu installer) for upgrade process.
References: man apt-clone, How to backup settings and list of installed packages

  • Thanks, works fine! – abu_bua Jul 12 '20 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy