How to List Installed Packages on Debian 12?
Debian 12 comes with a large number of packages that users can install and use. But sometimes, users may want to know what packages are installed on their system, either for maintenance, troubleshooting, or curiosity.
One of the most common tasks for a Debian system administrator is to list the installed packages on the system. It offers stability, security, and a large software repository to suit any need (version of a package, uninstall a package, or find out if a package is available).
This guide will discuss enlisting the installed packages on Debian 12.
How to List Installed Packages on Debian 12?
There are several ways command-line tools, graphical tools, and web-based tools to list installed packages on Debian 12, depending on user needs. It offers to filter, sort, and export the list of installed packages for further analysis.
To list installed packages on Debian 12, use the below methods:
- Method 1: Using dpkg Command
- Method 2: Using apt Command
- Method 3: Using aptitude Command
- Method 4: Using Synaptic Package Manager
- Method 5: Using snap
Let’s begin with the first one.
Method 1: List Installed Packages on Debian 12 Using dpkg Command
The dpkg is a tool for managing Debian packages. It can be utilized to install, remove, update, and query information about the packages installed on a Debian 12 system.
To list all installed packages on Debian 12 using dpkg, use the “dpkg” command with the “l” utility:
dpkg -l
This displays a table with four columns: the package name, the version, the architecture and a short description. Users need to scroll up and down to see the complete list of installed packages.
Alternative Way
To view the installed packages with their respective date and installation times, use the “/var/log/dpkg.log” log file with the “grep “ installed ”” command:
grep " installed " /var/log/dpkg.log*
Customize Output from the dpkg Command
To explore more examples of list installed packages on Debian 12, or how to filter and sort the output, follow below cases:
- List Packages by Name or Pattern
To list only the packages that match a specific name or pattern, use the “dpkg” command with the “-s” option and provide the name or pattern as an argument. For instance, list all the packages that start with “GNOME”:
dpkg -s GNOME
It displays information such as the package status, priority, section, maintainer, architecture, dependencies, conflicts, provides, replaces, enhances, description, and homepage.
- Filter List Installed Packages
To list only the names of the installed packages, use the “dpkg-query” command with the “-f” or “–showformat” option. It allows users to specify a format string that controls how each package is displayed. For example, to show only the package names, use the format string “${Package}\n”:
dpkg-query -f '${Package}\n' -W
- List Installed Packages with Certain Patterns
To list only the packages that match a certain pattern, use the “dpkg” command with the “-l” option and a glob expression as an argument. such as “?” (matches any single character and “*” (matches any number of characters). For instance, list only the packages that start with “a”:
dpkg -l 'a*'
- Sort the Output (Ascending Order)
To sort the output of the “dpkg” command by a certain column, use the “sort” command with the “-k” or “–key” option. It allows users to specify which column to sort by and how to sort it (numerically, alphabetically, etc.). For instance, sort the output by package name in ascending order:
dpkg -l | sort -k2
- Store List of Installed Packages in a File
To store installed package information in a file, users can specify the path “/var/lib/dpkg/info/” and store in a text file “list.txt” as below:
ls -tl /var/lib/dpkg/info/ | grep list > list.txt
Users can also use the below options to filter or format the output:
dpkg -l | grep keyword # to search for a specific package by name or description
dpkg -l | less # to view the output in a pager
dpkg -l | wc -l # to count the number of installed packages
dpkg -l | sort -k3 # to sort the output by package version
dpkg -l | awk '{print $2}' # to print only the package names
These are some of the possible ways to use the dpkg command to list the installed packages on Debian 12. For more information, check the man pages of “dpkg” and “dpkg-query”.
Method 2: List Installed Packages on Debian 12 Using apt Command
The apt command is a powerful tool that can assist users in managing packages, including listing, installing, removing, updating, and upgrading them. It is a high-level tool as compared to “dpkg”. It also provides commands for managing as well as searching packages.
To list all the installed packages on Debian 12 using apt, use the “apt list” command with the “installed” utility:
apt list --installed
It enlists package names followed by their versions and architectures.
Customize Output from the apt Command
To use the apt command to list the installed packages on Debian 12, with some examples and explanations.
- List Packages by Name
To list only the packages that contain the word “python” in their names, use the “grep” command with a pipeline of “apt list” command with the “installed” utility:
apt list --installed | grep python
- Details a Specific Package
To get more details about a specific package, use the “<package_name>” such as “apt” as below:
apt show apt
It shows information such as the package priority, section, maintainer, architecture, dependencies, conflicts, provides, replaces, enhances, description, homepage, download size, and installed size.
- List Installed Packages (Manually)
To list only the manually installed packages on the Debian 12 system, use the “apt-mark” command with the “showmanual” utility:
apt-mark showmanual
It visualizes a shorter list of packages that the user explicitly installed, and not automatically installed as dependencies of other packages.
- List Installed Packages (Automatically)
To list only the automatically installed packages on Debian 12, use the “apt-mark” command with the “showauto” utility:
apt-mark showauto
It displays a longer list of packages that were automatically installed as dependencies of other packages, and not explicitly installed by the user.
- List No Longer Required Packages
To list only the packages that are no longer required on Debian 12, use the “apt” command with the “autoremove”:
apt autoremove --dry-run
It enlists packages that were automatically installed as dependencies of other packages. However, it is not required by any package on the system.
Optional: Remove Packages
To remove these packages, run the same command without the “–dry-run” option:
sudo apt autoremove
- Filter/Format the List of the Installed Packages
To filter or format the list of the installed packages on Debian 12, the apt command can be used with the below-mentioned options:
apt list --installed | grep keyword # to search for a specific package by name apt list --installed | less # to view the output in a pager apt list --installed | wc -l # to count the number of installed packages apt list --installed | sort -V # to sort the output by package version apt list --installed | cut -d/ -f1 # to print only the package names
For more information about the apt command and its options, check its man page by typing:
man apt
It is all about the list of installed packages on Debian 12 using the apt command.
Method 3: List Installed Packages on Debian 12 Using aptitude Command
Aptitude is a text-based interface (another high-level tool) to the Debian package management system. It permit users to accomplish several operations on packages, such as installing, removing, upgrading, searching, and displaying information.
To list all the installed packages on Debian 12 using aptitude, use the “aptitude” command with the ‘~i’ utility along with the “search”:
aptitude search '~i'
The ‘~i’ pattern matches all the packages that have the “i” flag, which means they are installed. The output shows the package name, version, and a brief description for each installed package.
Note: Users enlist the package names preceded by a letter that indicates their state (i for installed, p for purged, c for config files remaining, etc.).
Fix: If the user faces the “bash: aptitude command not found, execute the “sudo apt install aptitude” command to install the “aptitude” command utility.
Customize Output from the Aptitude Command
Users can also use some options to customize the output of the aptitude command as below:
- Details About a Specific Package
To get more details about a specific package, use the “<package_name>” such as “apt” with the “aptitude show” command:
aptitude show apt
This shows users information like the “apt show” command.
- Show Package Name and Version
To show only the package name and version, use the “aptitude search” command with the “-F” option. It specifies a custom format for each package line. Such as %p for package name, %v for version, %d for description, and so on:
aptitude search '~i' -F '%p %v'
Note: You can also use the “–disable-columns” option to disable the automatic alignment of columns in the output. This can make the output more compact and easier to read.
- More Suitable Output
Another option that can be useful is the “-q” option, which suppresses the progress indicator and the legend at the end of the output. This makes the output more suitable for scripting or piping to other commands:
aptitude search '~i' -q '%p %v'
To filter or format the output of installed packages on Debian 12, use the following options:
aptitude search '~i' | grep keyword # to search for a specific package by name or description
aptitude search '~i' | less # to view the output in a pager
aptitude search '~i' | wc -l # to count the number of installed packages
aptitude search '~i' | sort -k2 # to sort the output by package name
aptitude search '~i' | awk '{print $2}' # to print only the package names
For more information about the “aptitude” command and its options, consult its manual page by typing:
man aptitude
It is all from the aptitude command regarding the listing of installed packages on Debian 12.
Method 4: List Installed Packages on Debian 12 Using Synaptic Package Manager
This manager manages the software packages on Debian 12. To list the installed packages using Synaptic, click on the “Status” button on the left sidebar and select the “Installed” category from the list:
It enlists all the installed packages on the system, along with their versions, sizes, and descriptions.
Note: Users can also search for a specific package by typing its name in the Quick filter box at the top.
Method 5: List Installed Packages on Debian 12 Using snap
Listing installed packages on Debian 12 is a useful skill for system administrators and users who want to manage their software and keep track of their system configuration.
To list the “snap” packages on Debian 12, run the “list” utility with the “snap” command:
snap list
For this, users may be required to install snap on Debian 12 via the “sudo apt install snap” or “sudo apt install snapd” commands.
That is all from the guide to listing the installed packages on Debian 12.
Conclusion
To list installed packages on Debian 12, use the “dpkg” command, the “apt” command, or the “aptitude” command. Alternatively, use “snap” as well as “synaptic” package manager to list the installed packages on Debian 12. They display the packages and their versions, statuses, and descriptions. Users can also use various options and filters to customize the output and search for specific packages.
This article has shown all methods to list all the installed packages on Debian 12.





















