How do I see what packages are installed on Ubuntu Linux?

last updated in Categories , ,

I am a new Ubuntu Linux server user. My server hosted at Google cloud VM. How do I see what packages are installed on Ubuntu Linux?

Introduction: Ubuntu Linux is an open source operating system based upon the Linux kernel and GNU command line utilities. Ubuntu Linux is extremely popular among new Linux users as well as developers all around the globe. This page shows how to list all installed packages with apt command or apt-get command on Ubuntu Linux.

You need to use the apt or apt-get or dpkg command to list all installed packages on an Ubuntu Linux server from the bash shell prompt.

How do I see what packages are installed on Ubuntu Linux?

The procedure to list what packages are installed on Ubuntu:

  1. Open the terminal application or log in to the remote server using ssh (e.g. ssh user@sever-name)
  2. Run command apt list --installed to list all installed packages on Ubuntu
  3. To display a list of packages satisfying certain criteria such as show matching apache2 packages, run apt list apache

Let us see some examples,.

apt list installed packages

Let us list all software packages on Ubuntu Linux available for us:
$ apt list
How do I see what packages are installed on Ubuntu Linux
You might want to use the grep command/egrep command to filter out:
$ apt list | grep nginx
OR
$ apt list | more
However, you may see message on screen that read as follows:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

To avoid this message use the dpkg command as follows:
$ dpkg --list | grep nginx
$ dpkg --list | more

List all installed packages only

The apt command displays both installed and packages available to install. What if you want to list currently installed software only? Fear not, pass the option to the apt command:
$ apt list --installed
Ubuntu list installed packages with apt-get

How to list or find out if a specific package installed or not

Run package policy as follows:
$ apt list -a pkgNameHere
Is sudo package installed?
$ apt list -a sudo
Is sudo package mariadb-server?
$ apt list -a mariadb-server
apt-get list installed packages on Ubuntu Linux

Ubuntu list installed packages

It is also possible to list installed packages matching given pattern. The syntax is:
dpkg -l pattern
dpkg --list pattern
apt list pattern
apt list --installed pattern

For example:
dpkg --list x*
Sample outputs:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                           Version                      Architecture                 Description
+++-==============================================-============================-============================-==================================================================================================
ii  xauth                                          1:1.0.10-1                   amd64                        X authentication utility
ii  xdelta3                                        3.0.11-dfsg-1ubuntu1         amd64                        Diff utility which works with binary files
ii  xdg-user-dirs                                  0.17-1ubuntu1                amd64                        tool to manage well known user directories
un  xflr5                                          <none>                       <none>                       (no description available)
un  xfsdump                                        <none>                       <none>                       (no description available)
ii  xfsprogs                                       4.9.0+nmu1ubuntu2            amd64                        Utilities for managing the XFS filesystem
ii  xkb-data                                       2.23.1-1ubuntu1              all                          X Keyboard Extension (XKB) configuration data
un  xloadimage                                     <none>                       <none>                       (no description available)
un  xorriso                                        <none>                       <none>                       (no description available)
un  xterm                                          <none>                       <none>                       (no description available)
un  xvt                                            <none>                       <none>                       (no description available)
ii  xxd                                            2:8.0.1453-1ubuntu1          amd64                        tool to make (or reverse) a hex dump
un  xz-lzma                                        <none>                       <none>                       (no description available)
ii  xz-utils                                       5.2.2-1.3                    amd64                        XZ-format compression utilities

Where,

  • ii – Indicates that package named xauth installed.
  • un – Indicates that package not installed or in Unknown status.

Conclusion

You learned how to list both installed and uninstalled packages on an Ubuntu Linux server or desktop using the CLI method.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.