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 Openshot Video Editor 2.3.3 on Ubuntu & Linux Mint

OpenShot Video Editor 2.3.3 recently released, is a free, open-source video editor that allows you to take videos, photos,...
28/12/2020

How to Keep Ubuntu 17.10 up to Date

When you install Ubuntu from a ISO image, the operating system is not up to date. Because the ISO is not updated on the official...
12/02/2020

Install Samba on Ubuntu

Ubuntu 16.04 as an SMB File Server Linux belongs in the server space, and as a sysadmin, one of the most common tasks is...
28/12/2020
Bài Viết

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

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024