List all installed packages on Debian

29/12/2020
Chưa phân loại
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.

dpkg/dpkg-query

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

Try:

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>

Try:

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>

Try

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

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.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Markdown Tutorial — From Setup to Syntax

Markdown is an easy to read and easy to learn markup language. Unlike HTML, XML or other markup languages, where the insane...
28/12/2020

Read Syscall Linux

So you need to read binary data? You may want to read from a FIFO or socket? You see, you may use the C standard library...
29/12/2020

Differences Between Release Engineering and DevOps

Today most companies are adopting some form of DevOps and configuration management philosophy. They are automating their...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Huớng dẫn dùng proxy cho ios, iphone 2023
23/09/2023

Cách gắn set proxy cho điện thoại android, oppo, giả lập android, Ldplayer Bằng Proxydroid
20/09/2023

Mua Proxy Socks5 VN Chơi Game Gia Lập Tăng Cường Trải Nghiệm Chơi Game
22/06/2023

Mua Proxy Mỹ, Us Nuôi Tài Khoản Etsy, eBay Tìm Hiểu Về Mua Proxy Mỹ tại Onet.com.vn
22/06/2023

Mua Proxy Game – Giải pháp tuyệt vời cho việc chơi game trên mạng mà không bị giới hạn về vị trí địa lý
03/06/2023