How to List Installed Packages on Ubuntu

By 

Updated on

5 min read

List Installed Packages with apt and dpkg on Ubuntu

A long-running Ubuntu system accumulates hundreds of packages, and sooner or later you will need to see what is on it. Common reasons include cloning the package set to another machine, auditing what was added over time, or confirming that a specific tool is installed before you troubleshoot it.

This guide shows how to list and filter installed packages on Ubuntu using apt and dpkg, how to inspect a single package, and how to export the full list so you can reinstall it elsewhere.

The same commands apply to any Ubuntu-based distribution, including Kubuntu, Linux Mint, and elementary OS.

List Installed Packages with apt

The apt command is the standard front end for package management on Ubuntu and combines the most common operations from apt-get and apt-cache, including listing installed packages.

To print every installed package, run:

Terminal
apt list --installed

The listing commands shown in this guide only read package metadata, so they do not need sudo.

The output is long, and each line shows the package name, repository origin, version, and architecture:

output
accountsservice/noble,now 23.13.9-2ubuntu6 amd64 [installed]
acl/noble,now 2.3.2-1build1.1 amd64 [installed]
acpi-support/noble,now 0.144 amd64 [installed]
adduser/noble,now 3.137ubuntu1 all [installed,automatic]
...

The [installed] marker means the package was installed explicitly, while [installed,automatic] indicates it was pulled in as a dependency of another package.

You will often see a warning on the first line:

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

The message is safe to ignore when you run apt interactively. In scripts, redirect standard error to /dev/null or use dpkg-query instead:

Terminal
apt list --installed 2>/dev/null

To scroll through the list comfortably, pipe it to less :

Terminal
apt list --installed | less

Filter the List for a Specific Package

To check whether a particular package is installed, pipe the output through grep and match the package name at the start of the line. For example, to look for the screen package:

Terminal
apt list --installed 2>/dev/null | grep '^screen/'
output
screen/noble,now 4.9.1-1 amd64 [installed]

The output confirms that screen version 4.9.1-1 is installed on the system.

List Installed Packages with dpkg-query

dpkg-query queries the dpkg database directly and works the same across every Debian-based release. The -l view shows package status codes such as ii for installed packages and rc for packages that were removed but still have configuration files left behind. It also returns a short description for each package, which makes it easier to recognize what something does:

Terminal
dpkg-query -l | less
output
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  accountsservice   23.13.9-2ubuntu6  amd64        query and manipulate user account
ii  acl               2.3.2-1build1.1   amd64        access control list - utilities
ii  adduser           3.137ubuntu1      all          add and remove users and groups
...

When you want to check one exact package, query it directly:

Terminal
dpkg-query -l 'screen'

In the output, a line that starts with ii means the package is currently installed.

Show Details About a Specific Package

When you want more than a name and version, apt show prints the full metadata for a single package, including its description, size, and dependencies:

Terminal
apt show nginx

dpkg -s reads the same information from the local database without contacting any repository:

Terminal
dpkg -s nginx

To see every file a package placed on disk, use dpkg -L:

Terminal
dpkg -L nginx

This is useful when a command is not on your $PATH and you want to find out where the package put its binaries.

List Only Manually Installed Packages

The full listing mixes explicitly installed packages with their dependencies. To see only the packages you (or a script) installed directly, use apt-mark:

Terminal
apt-mark showmanual

This is the right list to use when you plan to reinstall the same environment on another machine. You will rebuild the dependency packages automatically when you install the manual ones.

Export the List of Installed Packages

To save the names of all installed packages to a file for later use, run:

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

The -f option defines the output format, and -W prints one row per installed package.

On another machine, reinstall every package from that file with:

Terminal
sudo xargs -a packages_list.txt apt install

Count Installed Packages

To find out how many packages are installed on your system, pipe the same query into wc:

Terminal
dpkg-query -f '${binary:Package}\n' -W | wc -l
output
1893

The number above was produced on a desktop install of Ubuntu 24.04. A minimal server will usually report a much smaller count.

Check When a Package Was Installed

Ubuntu keeps a log of package operations under /var/log/apt/. The human-readable history file is the easiest place to start:

Terminal
less /var/log/apt/history.log

Each block shows the start time and the packages that were installed, upgraded, or removed during that run. If you want a machine-friendly view, search the dpkg log instead:

Terminal
grep " install " /var/log/dpkg.log

Older entries are rotated into /var/log/apt/history.log.*.gz and /var/log/dpkg.log.*.gz. Use zgrep to search through the compressed files:

Terminal
zgrep " install " /var/log/dpkg.log.*.gz

FAQ

Do I need sudo to list installed packages?
No. apt list --installed, dpkg-query -l, apt show, and dpkg -s only read the local package database, which is world-readable. Using sudo for these commands does not change the output.

How do I list only the packages I installed myself, without their dependencies?
Run apt-mark showmanual. It prints every package that was installed explicitly and skips anything pulled in as a dependency.

How do I find which package owns a file?
Use dpkg -S followed by the full path: dpkg -S /usr/bin/nginx. The command prints the package name that provides that file.

Why does apt print a warning about the CLI interface?
The warning reminds you that apt is built for interactive use and its output format can change between releases. In scripts, either redirect stderr with 2>/dev/null or use dpkg-query, which has a stable output.

Conclusion

You now have a full set of tools for auditing packages on Ubuntu: apt list --installed for a quick overview, dpkg-query for detailed listings, apt-mark showmanual for user-installed packages, and the apt logs for install history. To learn more options, see our guide on the apt command .

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page