Ubuntu

Ubuntu Get a List of Installed Packages

Ubuntu Get a List of Installed Packages

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.

How to Change Mouse and Touchpad Settings Using Xinput in Linux
Most Linux distributions ship with “libinput” library by default to handle input events on a system. It can process input events on both Wayland and X...
Remap your mouse buttons differently for different software with X-Mouse Button Control
Maybe you need a tool that could make your mouse's control change with every application that you use. If this is the case, you can try out an applica...
Microsoft Sculpt Touch Wireless Mouse Review
I recently read about the Microsoft Sculpt Touch wireless mouse and decided to buy it. After using it for a while, I decided to share my experience wi...