How to List Installed Packages in Ubuntu

It is useful to be able to quickly find out what packages are currently installed on your Ubuntu system, especially if you are planning a re-install or setting up the same configuration on a different machine.

 

In this tutorial, we will learn how to list all the packages currently installed in Ubuntu and how to check if a specific one is installed.

 

List all Installed Packages

To list all the installed packages we can use apt, which is a command-line interface for Linux-like systems including Ubuntu. Specifically, we will use the apt list utility followed by the --installed flag like this:

 

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

 

This will return a hefty list of all the installed packages in alphabetical order. It might easier to pipe the output into another program and filter down the list.

 

Here is an example of using apt list with grep to look for all installed packages related to Python.

 

sudo apt list --installed | grep python

 

Another option is to use less, which will allow you to read the output on a page-by-page basis.

 

sudo apt list --installed | less

 

Count Installed Packages

Installed packages can be counted by piping the output of apt list to wc, which will count the lines.

 

sudo apt list --installed | wc -l
1208

 

Save a List of Installed Packages in Ubuntu

To create and save list of all the installed packages in Ubuntu and save it to a .txt file use the following command:

 

dpkg-query -f '${binary:Package}\n' -W > pkglist.txt

 

Conclusion

You now know how to get a list of all installed packages in Ubuntu and filter them to make it easier to see if specific ones are there.

ubuntu package