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:
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:
If we want to search for a specific .deb package and if it’s installed run:
Then try with a package you know you don’t have, in my case ill use tomcat:
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:
Again the dpkg-query equivalent will throw the same output
If you want to list all files belonging to a package type:
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:
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 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:
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:
You can also add the less parameter to have a comfortable view, allowing to pass lines and pages easily.
With apt we can also use grep to look for a specific package, on the console type:
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:
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.