Generate a list of installed deb packages on one device (and install on another)

Last edited on 2022-01-30 Tagged under  #debian   #lmde   #linux   #bash   #programming 

When setting up a new device with Debian or LMDE, it can be useful to have an updated list of all the deb packages installed on the current device, and replicate that configuration on the new device.

This is how I do it ...

Make a list

Make a list of *.deb packages installed on current device, and save to $LIST ...

$ LIST="${HOME}/deb_pkglist_${HOSTNAME}"
$ dpkg-query -f '${binary:Package}\n' -W > $LIST


I wrote a script - aaa - that combines in a single command:

  • update list of installed packages (deb_pkglist)
  • update the package database (apt update)
  • run a full upgrade (apt full-upgrade)
  • clean package repository (apt autoclean)
  • remove packages automatically installed to satisfy dependencies and no longer needed (apt autoremove)


Replicate the list on another device. Copy $LIST from current device to the new device.

Install $LIST contents ...

$ sudo xargs -a $LIST apt install

Note: Confirm the new device lists the same repositories in /etc/apt/sources.list as the current device. Otherwise, some packages in $LIST might not be available.

Sources: deb_pkglist and aaa

Thanks for reading! Read other posts?

» Next: Getting started with Neovim

« Previous: Dot bashrc