ubuntu list installed packages

Installing packages on Ubuntu is a smooth experience thanks to its extensive repositories and support for multiple package managers. But after a while, you might notice that your system is starting to get bloated.

If you want to check what packages are installed, apt list --installed can work as it lists all the installed packages. But this list also includes system-installed packages and dependencies.

This list numbers in the thousands, and manually digging through it isn’t really practical. Instead, we recommend following the methods from this article to refine your search.

List Installed Apt Packages

As stated, the basic command to list all packages installed using apt is

apt list --installed

This lists packages and libraries along with the package version, architecture, and how the package was installed. 

  • [installed] – The package was manually installed from the Ubuntu repo.
  • [installed, automatic] – The package was automatically installed as a dependency.
  • [installed, local] – The package was locally installed.

You can check whether a package is installed or not by specifying its name.

apt list discord

Or, if you don’t remember the full package name, you can use a wildcard and search through the installed list like so

apt list --installed dis*

You can get further info about a package with the show option.

apt show discord

And if you want to check which installed packages can be upgraded, you can use

apt list --upgradeable

Finally, since apt is just a front-end to dpkg, you can also use dpkg-query to query the dpkg database and list the installed packages. 

dpkg-query -l | less
dpkg-query -W -f='${binary:Package}\n'

List Manually Installed Packages

If you only want to list the packages you installed yourself, you can use apt-mark with the showmanual option and sort the output as done below.

comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)

Sort Packages By Date & Time

You can check the dpkg log if you want to see the records of installed packages based on the date and time. But do keep in mind that because it’s an event log, older install events might also be recorded. If you’ve removed certain packages recently, you might misinterpret them as still being installed.

zgrep " installed " /var/log/dpkg.log*

Check Installed Packages via GUI

You can also view a list of installed packages from the Ubuntu Software app’s Installed tab. But this list is very limited and doesn’t show any dependencies.

If you want an extensive list of installed packages from a GUI-based package manager, try Synaptic instead.

sudo apt install synaptic

You can apply the Installed filter from the Status tab to list only installed packages. Similarly, you can use the Search tool to search based on various criteria.

Snap & Flatpak Packages

Apt is the standard package manager on Ubuntu, but Canonical is increasingly pushing for snap usage. For users who don’t like snap, flatpak is a popular alternative.

If you use either of these and want to list the packages installed with these package managers, you can use 

snap list
flatpak list

Count Total Installed Packages

If you’re curious about the total number of packages installed on your system, you can check it with the word count (wc) tool.

apt list --installed | wc -l
dpkg-query -f '${binary:Package}\n' -W | wc -l

Create a List of Installed Packages

Since the package list tends to be pretty long, it’s common to print the output to a file for better accessibility and readability. 

First, we’ll create the package list with

apt list --installed | awk -F/ -v ORS=" " 'NR>1 {print $1}' > packagelist.txt

You can use this file to install all your packages on a different system. This is very useful for quickly setting up fresh systems after a clean install.  

sudo xargs -a packagelist.txt apt install

Alternatively, you can also use dpkg to create the package list. Either of these commands will work for that.

dpkg-query -f '${binary:Package}\n' -W > packagelist.txt
dpkg --get-selections | grep -w "install" | cut -f1 &gt; packagelist.txt

Like earlier, you can install the packages listed in the file with

sudo xargs -a packagelist.txt apt install
Anup Thapa

Senior Writer

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys reading up on a range of topics, traveling, working out, and MOBAs.