list installed packages in ubuntu

How to List All Installed Packages in Ubuntu

Sometimes you may need to find out all packages installed on your Ubuntu system. You can easily do this using list or dpkg command. In this article, we will look at how to list all installed packages in Ubuntu. We will also look at how to differentiate between installed & non-installed packages. And we will also look at how to search for specific package in Ubuntu, to get its details.


How to List All Installed Packages in Ubuntu

Here are the steps to list all installed packages in Ubuntu.


1. Using apt-get command

You can get a list of all installed packages on your system using apt list command.

$ sudo apt list
Listing…
0ad/bionic 0.0.22-4 amd64
0ad-data/bionic 0.0.22-1 all
0ad-data-common/bionic 0.0.22-1 all
0install/bionic 2.12.3-1 amd64
0install-core/bionic 2.12.3-1 amd64
...

In the above output, each line displays a package name along with its version. It lists both installed and not installed packages. This can be a really long list so it is advisable to run it with more command, for a page by page display.

$ sudo apt list | more

You may also use grep command to search for a specific package in the output of apt list. This will list only the relevant packages you are looking for.

$ sudo apt list | grep apache

You may also use apt list with -a option for the above output.

$ sudo apt list -a apache

If you want to view only installed packages, use –installed option with apt list command.

$ sudo apt list -- installed
Listing…
accountsservice/bionic-updates,bionic-security,now 0.6.45-1ubuntu1.3 amd64 [installed,automatic]
acl/bionic,now 2.2.52-3build1 amd64 [installed,automatic]
acpid/bionic,now 1:2.0.28-1ubuntu1 amd64 [installed,automatic]
adduser/bionic,now 3.116ubuntu1 all [installed,automatic]

Please note, in this case all packages will have the keyword installed, at their end.


2. Using dpkg command

You may also use dpkg command to list installed packages.

$ sudo dpkg --list

Again, this output may be really long, so you may want to use it with more command.

$ sudo dpkg --list | more

If you want to list only installed packages use –installed option.

$ sudo dpkg --installed
Listing…
accountsservice/bionic-updates,bionic-security,now 0.6.45-1ubuntu1.3 amd64 [installed,automatic]
acl/bionic,now 2.2.52-3build1 amd64 [installed,automatic]
acpid/bionic,now 1:2.0.28-1ubuntu1 amd64 [installed,automatic]
adduser/bionic,now 3.116ubuntu1 all [installed,automatic]

Here too, all installed packages will contain the keyword “installed” at their end.

You may also pipe the output of above commands to grep to search for a specific package. Here is an example to search for apache package.

$ sudo dpkg --list | grep apache

In this article, we have looked at how to list both installed and non-installed packages. We have also looked at how to search for specific package.

Also read:

How to Find & Replace String in VI Editor
How to Find Parent Process ID in Linux
How to Change Default Shell in Linux
How to Install Moodle with NGINX in Ubuntu
How to Download File in Python

Leave a Reply

Your email address will not be published.