Nick Francesco

Linux Stuff

Installed Packages

Create List of All Installed Packages on a Debian-based System

dpkg --get-selections > pkglist.txt
apt-key exportall > repokeys.txt

Installed with snap

snap list > snaplist.txt

You now have on your system three files:

  • pkglist.txt - a list of all the packages installed with the apt package manager
  • repokeys.txt - a file with all the keys to all the repositories of the programs you've installed
  • snaplist.txt - a file with all the packages you've installed with snap
You can save those files off somewhere safe. If you ever need to reproduce that system, you can:

Restore All Previously Installed Packages

Installed with apt

sudo dpkg --set-selections < pkglist.txt
sudo apt-get dselect-upgrade -y
sudo apt-key add repokeys.txt

Right now, I believe you'll have to reinstall snaps by hand. But at least you'll have a list! Also, this won't set your preferences, like if a shortcut is on the desktop, but all the programs you use will be there.

You can also use the snap save and snap restore to save and restore a snapshot of all the snaps on your system, but those files tend to be very large. Particularly on Ubuntu 24.04, which uses snaps much more extensively than did previous versions.

Return to the Linux page


Subscribe to the Ask Nick! Newsletter - only $25.00 per year!     Leave feedback for Nick   Disclaimer