Debian System Administration

List all installed packages on Debian

This tutorial will explain how to list installed packages on Debian, including all options to list the necessary packages. On LinuxHint was already explained how to uninstall packages in Debian, that article included a brief introduction to packages listing, now all options for listing packages will be explained using dpkg, dpkg-query and apt package managers.


Debian packages manager is dpkg, dpkg is the command we use to install, remove and manage Debian packages. To know how dpkg files are created you can check this article on the topic.

To do a simple full list of all packages installed in our Debian system run:

dpkg -l

As you see there are 4 columns displaying the program names, versions, architecture support and description.

A dpkg-query -l command will throw exactly the same output, two ways to get the same information on packages:

For a more comfortable view you can add the less parameter, run from the console:

dpkg-query -l | less

If we want to search for a specific .deb package and if it’s installed run:

dpkg -s <package> | grep Status


dpkg -s nano | grep Status

Then try with a package you know you don’t have, in my case ill use tomcat:

dpkg -s tomcat | grep Status

As you can see the first output says nano is installed, while the second says tomcat isn’t installed but available.

Now if we want to list the specific package with  the information provided with dpkg -l type:

dpkg -l <package>


dpkg -l nano

Again the dpkg-query equivalent will throw the same output

If you want to list all files belonging to a package type:

dpkg -L <filename>


dpkg -L nano

This command lists all files belonging to nano and it’s paths. We can have this information before installing the package, get a .deb package and try:

dpkg -c <.deb>

In this case dpkg -c shows the directories and files which will get installed with Teamviewer.

Now let’s find out the total number of packages installed in our device, run:

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

dpkg-query allow us to export a list of installed packages which we can use later to reinstall the same software on a different device. To create a list of installed packages run:

dpkg-query -f '${binary:Package}\n' -W > inststalledPackages

Now try:

less inststalledPackages


Apt (Advanced Package Tool) is another packages manager available on Debian and Ubuntu based Linux distributions. Despite to find information on packages dpkg has advantages over apt, apt is better since it can resolve dependencies when installing software. But also apt can be useful to list packages and get information on them.

To get a list of installed packages with apt run:

apt list --installed

You can also add the less parameter to have a comfortable view, allowing to pass lines and pages easily.

apt list --installed | less

With apt we can also use grep to look for a specific package, on the console type:

apt list --installed | grep -i nano

You can ignore the warning, apt informs about the package’s presence.

If we want to list dependencies for a package with apt, type in the terminal:

apt-cache depends <program>

This output reveals Teamviewer’s dependencies.I hope you found this article on listing programs and their information on Debian and Ubuntu systems. As you see each program (dpkg, dpkg-query or apt) has it’s own advantages and disadvantages, while dpkg/dpkg-query allow us to gather more information apt can help where dpkg fails like dependencies.Keep following LinuxHint for more tips and updates on Linux.

About the author

Ivan Vanney

Ivan Vanney

Ivan Vanney has over 2 years as writer for LinuxHint, he is co-founder of the freelance services marketplace where he works as a sysadmin.