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.


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
| improve this answer | |

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
| improve this answer | |

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.