I have to reinstall my system (Debian Linux), and need to install the same packages I previously installed with Synaptic.

Synaptic has menu options to save and reload a file which contains a list of the installed packages.

Since I cannot use the GUI (I am dealing with a broken system), how can I perform these operations from the command line?

I did not save such a list in the past, so I would need to do it now. Is it possible to do it with Synaptic from the command line? Can I use apt? Is there a file with the list of installed packages, even if I did not ask to create one?

dpkg --get-selections > list.txt


dpkg --set-selections < list.txt
apt-get -f install

But if you want to end up with the same working system like you have now, it's easier (and faster) to fix the errors than reinstalling everything from zero.

  • Yes, I will keep trying to fix it for a while. However I also needed this trick to clone my system on different machines, with different architectures.
    – Pietro
    Oct 12 '18 at 14:08

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.