Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to reinstall my linux system (specifically linux mint). I have kept important data elsewhere, so I can safely remove everything.

However, I want to do the following:

  1. save the list of packages I have installed so far
  2. after reinstall take the backup list and use it to install packages

Are there tools that can assist in doing this. I know I can use dpkg -l to get list but perhaps I only want the leafs - packages that no other depend on.

share|improve this question

You can save you current list with

dpkg --get-selections > sel.list

and copy this file in safe place to be able copy it on a new machine. (and also you should backup your settings from /etc/ dir if you did some changes there)

To restore it with you should run:

sudo dpkg --set-selections < sel.list
sudo apt-get update && sudo apt-get -u dselect-upgrade
share|improve this answer
Is there a dpkg command that will list all modified configuration-files? – Nils Mar 11 '13 at 13:45
@Nils check this serverfault.com/questions/90400/… – rush Mar 11 '13 at 14:48

The problem with using dpkg --get-selections is that it does not preserve some package states such as "automatically installed". To preserve all data, you can use the aptitude front-end to backup and restore the package list:

aptitude search -F '%100p' '~i!~M' > package_list #backup

xargs aptitude --schedule-only install < package_list
aptitude install #restore
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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