Little Girl's Mostly Linux Blog


Back up and restore my package list

This page was last updated on October 15, 2009.

  1. Create a text file containing a list of my packages:
  2. dpkg --get-selections > mypackages.txt
  3. Install the packages from my package list onto another computer or a new copy of my operating system (Note that this must be the same release of the operating system the packages were on):
    1. Clear the dpkg selections:
    2. dpkg --clear-selections
    3. Show dpkg the list you made:
    4. dpkg --set-selection < mypackages.txt
    5. Install the packages:
    6. dselect update

Obligatory Happy Ending

And they all lived happily ever after. The end.


  1. Suggestions – before updating the package database with dselect update it might be best to configure the repositories (which you also copied from computer A, and then updated the list of repo signatures with apt-key add) with dselect access. Note that deselect update doesn’t actually install packages. Follow that command with apt-get dselect-upgrade to install your list of package selections.
    When you copy your list of installed packages from Computer A to Computer B, also copy across the installed packages to /var/cache/apt/archives. Apt is smart – it won’t download packages that are already in /var/cache/apt/archives which will save you time and your download allowance. If you don’t have all the original packages that are installed on Computer A – install dpkg-repack which can build .deb packages from installed packages, then, in the chosen directory run for i in $(dpkg –get-selections | grep -v deinstall | cut -f1);do dpkg-repack $i;done. The directory will now contain all the installation packages installed on the computer – even if the original repository no longer exists, or if you build the package from source (e.g. google-earth).

    Comment by Scott Ferguson — December 16, 2016 @ 8:57 pm

RSS feed for comments on this post. TrackBack URI


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: