Ubuntu: Get a List of Installed Packages

12/02/2020

How to List Installed Packages on Ubuntu

On an Ubuntu operating system, there are a lot of packages that are pre-installed. But you can also install new packages on top of that to enhance your Ubuntu experience as a user. Sometimes it is necessary to find out how many packages are installed, whether a specific package is installed or not, what version of that package is installed, what architecture the package belongs to etc. The good news is that you can find out all of this information.

I will show you how to find these information in this article. I will be using Ubuntu 17.10 Artful Aardvark for all the demonstrations. So let’s get started.

List all the installed packages:

You can use ‘dpkg’ command line utility to list all the installed software packages of your Ubuntu operating system from the terminal.

Run the following command to get a list of all the installed packages of Ubuntu:

$ dpkg --list

From the output of the command, you can see that the first column resembles the status of the installed package. The second column is the name of the package. The third column is the version of the package. The fourth column is the architecture of the package. The fifth column is the description of the package.

The two letters ‘ii’ here means that the package should be installed, and it is installed. The first letter describes the desired package status. The second letter describes the current status of the package.

Find whether a specific package is installed:

Let’s say you have a computer with Ubuntu installed and you want to find out whether openssh package is installed. You can easily do that. You can run ‘dpkg –list’ like before and filter the output with ‘grep’ or ‘egrep’ etc.

Run the following command to find whether openssh package is installed:

$ dpkg --list |  grep openssh

You can see that I have openssh-client, openssh-server and openssh-sftp-server packages installed on my Ubuntu 17.10 operating system.

Can you tell the version of these packages? Well you can. It’s 7.5p1-10

You can also tell the architecture, which is amd64 in this case.

You can also add more conditions. Like whether a specific version of specific package is installed. Let’s find out whether nano version 2.8 is installed.

Run the following command to find whether nano 2.8 is installed:

$ dpkg --list | grep nano | grep 2.8

You can see that the package was found.

You can add any number of conditions, just use more grep commands.

Find out how many packages are installed:

You can also find out how many packages are installed on your Ubuntu operating system. This is a little bit tricky, but it is possible. All you have to do is count the number of lines from ‘dpkg –list’ command’s output and subtract the number of lines taken by the header. That’s it.

From the previous output, you can see that the header consists of 5 lines. So we have to subtract 5 lines from the output.

Run the following command to find out how many packages are installed:

$ echo $((`dpkg --list | wc -l` - 5))

You can see that I have 1570 packages installed on my Ubuntu operating system right now.

So that’s how you list installed packages on Ubuntu 17.10 Artful Aardvark. Thanks for reading this article.

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

How to Install Life is Strange Episode 1 on Ubuntu

What’s so special about Life Is Strange? Life is Strange – Episode 1 was one of the most sought-after story-telling...
29/12/2020

How to install Exodus on Kodi 17 Krypton on Ubuntu 17.04

This post focuses on how to install exodus on Kodi 17 krypton running on Ubuntu 17.04 and below. Before we proceed on how...
12/02/2020

Best Text Editors for Ubuntu

If you are an application developer and perform all your coding on Ubuntu then this post can be very useful for you. Today...
28/12/2020