1.There's a directory,
/etc/apt/sources.list.dthat contains individual entries for each PPA you've added with
add-apt-repository. Those are the files you need to back up.
2.Many people find it easier to back up and restore a single file rather than dealing with a directory of files . 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.listlocated 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.
Another way of backing up repositories is:
y-ppa-manager or you could use
apt-clone to do that.