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

Ubuntu Boot Partition Full

In this article, I am going to talk about problems you may have with your boot partition getting full and how you remedy...
29/12/2020

How to install Syncthing – Continuous File Synchronization on Ubuntu

Syncthing is a continuous file synchronization open source software, that synchronizes files between two or more computers...
28/12/2020

Install Nvidia Drivers on Ubuntu

Install Nvidia Optimus Graphics Drivers on Ubuntu 17.10 In this article, I will show you how to install Nvidia Optimus drivers...
12/02/2020
Bài Viết

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

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024