There is a utility called y-ppa-manager https://launchpad.net/y-ppa-manager which helps to manage your ppa repositories in ubuntu. One of its best features is to backup your repository list. Is there any command line or graphical tool to backup your repositories without installing any ppa tool?

tar czf apt-sources.tar.gz /etc/apt/sources.list*
| improve this answer | |
  • simple as it could be, thanks, and also thanks @calmpitbull for his answer – zurdo Jan 31 '12 at 2:20
  • What about all the gpg keys, can they be backed up too? Or does ubuntu fetch them after re-install? – marto Mar 26 '12 at 14:48
  • @marto, they are part of the base install. You wouldn't be able to fetch anything without them. – psusi Mar 26 '12 at 14:49
  • why back up the official list then? Isn't this post about added 3rd party ppa's? – marto Mar 26 '12 at 14:58
  • 1
    @marto, ahh, yes, PPAs have their own keys. I'm not sure about how to back those up. – psusi Mar 26 '12 at 18:17

There is a folder called sources.list.d and a file called sources.list both need to be backed up, found in /etc/apt

I just navigated there using Nautilus and dragged them to my desktop.

To restore I opened Nautilus as admin: in terminal GKSU Nautilus and drag back in to the same folder.

Then in terminal: sudo apt-get update

There may be a better way, but I am not big on terminal commands.

1. Open Terminal
2. sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
3. sudo cp /etc/apt/sources.list.d /etc/apt/sources.list.d.backup

| improve this answer | |
  • Good to mention the source.list.d directory explicitly since this is where you find your own ppa repository and the like, that is most probably the stuff you want to carry along. – XavierStuvw Aug 17 '19 at 14:47

You can do it like this:

  1. Open Terminal
  2. cd /etc/apt
  3. gksudo gedit sources.list
  4. Copy and paste it to wherever you like.


  1. Open Terminal
  2. sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
| improve this answer | |
  • does it also backup the repositories from sources.list.d folder? – zurdo Jan 30 '12 at 22:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.