If you install software from a lot of PPAs, keeping track of them becomes hard, specially when you need to upgrade from one release to another or reintstall your distro for some reason. With just two commands, you can get a list of all PPAs in your system, save them in a file and restore them when needed.
To backup PPAs:
The following commands gives the list of PPAs explicitly installed in your system:
grep -RoPish "ppa.launchpad.net/[^/]+/[^/ ]+" /etc/apt | sort -u | sed -r 's/\.[^/]+\//:/'
To put them in a file, add > filename.txt in the end:
grep -RoPish "ppa.launchpad.net/[^/]+/[^/ ]+" /etc/apt | sort -u | sed -r 's/\.[^/]+\//:/' > backup.txt
To restore from backup and add all repositories that you have backed up:
<~/ppa-backup.txt xargs -I % sudo add-apt-repository %
Handy after upgrades!