Debian Logo Image

List Installed Packages on Debian

Read in 3 minutes   last updated 

by Linuxize

 

Apt is a command-line interface for the package management system and combines the most commonly used functionalities from apt-get and apt-cache including option to list installed packages.

To lists all packages installed on your system run the following command:

sudo apt list --installed adduser/stable,now 3.115 all [installed]
apt/stable,now 1.4.8 amd64 [installed]
apt-listchanges/stable,now 3.10 all [installed]
apt-utils/stable,now 1.4.8 amd64 [installed]
autoconf/stable,now 2.69-10 all [installed]
automake/stable,now 1:1.15-6 all [installed]
autotools-dev/stable,now 20161112.1 all [installed,automatic]
base-files/stable,now 9.9+deb9u5 amd64 [installed]
base-passwd/stable,now 3.5.43 amd64 [installed]
bash/stable,now 4.4-5 amd64 [installed]

The command will display a list of all installed packages including information about the packages versions and architecture. The rightmost column in the output shows whether the package was automatically installed as dependency of another package.

Since the packages list is long it is a good idea to pipe the output to the less command to make it easier to read:

sudo apt list --installed | less

To find out whether a specific package is installed use the grep command to filter the output. For example to find whether the tmux package is installed on the system you can use:

sudo apt list --installed | grep tmux tmux/stable,now 2.3-4 amd64 [installed] The output above shows that you have screen tmux 2.3-4 installed on your system.

List Installed Packages with dpkg-query

dpkg-query is a command line that can be used to display information about packages listed in the dpkg database.

To get a list of all installed packages type:

sudo dpkg-query -l | less
Computer architecture

The command will display a list of all installed packages including the packages versions, architecture and short description.

You can filter the dpkg-query -l output using the grep command:

sudo dpkg-query -l | grep package_name_to_search

Create a List of all Installed Packages

The following command will store the list of all installed packages on your Debian system to a file called packages_list.txt:

sudo dpkg-query -f '${binary:Package}n' -W > packages_list.txt

Now that you have the list, you can install the same packages on your new server with:

sudo xargs -a packages_list.txt apt install

Count the Number of Installed Packages

To find out how many packages are installed on your system you can use the same command as when creating a packages list but instead of redirecting the output to a file you can pipe it to the wc command to count the lines:

sudo dpkg-query -f '${binary:Package}n' -W | wc -l

The output will show the number of the installed packages:

466
Read More

Apt-get Add Repository

Debian Apt, Debian Linux, Debian Or Ubuntu, Debian Packages, Debian Ubuntu