How to List Installed Packages on Ubuntu

In this tutorial we are going to learn how to list installed packages on Ubuntu Linux. We will look at two commands: dpkg and apt.

List Installed Packages Using the dpkg Command

To see which packages are installed on your Ubuntu system, you can use the dpkg -l command:

dpkg -l

The output will be a list of packages in a formatted table with paging. You can scroll through the list using the up and down arrow keys. Useful keyboard shortcuts include Shift + G to jump to the end and pressing g twice to go back to the beginning.

To exit the list, press q or Ctrl + C on your keyboard.

The dpkg command also has another option for listing installed packages: --get-selections.

dpkg --get-selections

The --get-selections show just the package name without other details like package version and description that -l options shows. So the output is much cleaner.

Filtering Packages With grep

You can also filter the results of the dpkg by piping the output to grep command.

dpkg -l | grep apache
dpkg --get-selections | grep apache
ubuntu list installed packages
dpkg list installed packages

List Installed Packages Using the apt Command

You can also use the apt list command with the --installed option to view installed packages on Ubuntu.

apt list --installed
apt list --installed | grep ssh

Uninstall Packages From the Command Line

To uninstall a package or software from Ubuntu, first use the apt purge command to remove the package. Then run apt autoremove to clean up any dependency packages that are no longer needed.

sudo apt purge [package]
sudo apt autoremove

For example, to remove the Apache web server:

sudo apt purge apache2
sudo apt autoremove

All commands in this tutorial (dpkg -l, apt list, etc.) work on any Ubuntu version, including:

  • Desktop (Ubuntu 24.04 LTS, 22.04, etc.)
  • Server (Headless or cloud instances)
  • Debian-based distros (Linux Mint, Pop!_OS)