February 2, 2025

It can be useful to have a list of installed packages in Debian when using it on multiple PCs or importing it after a fresh install.

There is a quick way to do this directly from the Terminal by using the following command :

dpkg –get-selections > installedpackages.txt

exporting list of all installed packages to a text file in Debian

This will export the list of all installed packages and store it in a text file named installedpkgs.txt.

This file can be opened using any text editor or the contents be viewed from Terminal using cat command :

cat installedpkgs.txt

text file with a list of all the installed packages in Debian

It will have the names of all the installed packages and the status as install next to them.

You can keep this file and import it on other PCs that need the same list of packages to be installed or after a reinstall by the following command :

dpkg –set-selections < installedpackages.txt

You can also check if a specific package is installed or not by searching for it in this file provided it is updated :

searching for specific package and finding it from the package list in Debian

If the list finds the name of package, it will display the same, otherwise there will be no output.

To check if this list is updated or not, simply compare the output with the dpkg repository.

searching and not finding the required package from the list in Debian

So it’s a good practice to run the export command to update this list with all the recently installed packages before trying to import it on another PC which requires the same list or before a reinstall.

searching directly for specific packages from Debian repository

All done.

By admin

Related Post