How to List Installed Packages on Debian

Knowing how to list installed packages on your Debian system is useful when you need to replicate the same setup on another machine, audit what is installed, or troubleshoot dependency issues.
This guide explains how to list, filter, and count installed packages on Debian using apt, dpkg-query, and apt-mark. The commands work on Debian 13 and older supported Debian releases. Listing commands only read the local package database, so they do not need sudo.
Quick Reference
| Task | Command |
|---|---|
| List all installed packages | apt list --installed |
| Check if a package is installed | apt list --installed package_name |
| Filter installed packages | apt list --installed 2>/dev/null | grep '^package_name/' |
| Show installed package version | dpkg-query -W -f='${Version}\n' package_name |
| List manually installed packages | apt-mark showmanual |
| Count installed packages | dpkg-query -W -f='${db:Status-Abbrev}\n' | awk '$1 == "ii" { count++ } END { print count }' |
| Export manual package list | apt-mark showmanual > manual-packages.txt |
For a printable quick reference, see the APT cheatsheet .
List Installed Packages with apt
The apt command provides a straightforward way to list installed packages during interactive work:
apt list --installedadduser/trixie,now 3.152 all [installed]
apt/trixie,now 3.0.3 amd64 [installed]
base-files/trixie,now 13.8+deb13u5 amd64 [installed]
bash/trixie,now 5.2.37-2+b9 amd64 [installed]
coreutils/trixie,now 9.7-3 amd64 [installed]
...The output shows the package name, release channel, version, architecture, and installation status. Packages marked [installed,automatic] were installed as dependencies of another package.
Since the list is long, you can pipe the output to less for easier reading:
apt list --installed | lessCheck a Specific Package
To check whether a specific package is installed, pass the package name to apt list --installed:
apt list --installed nginxnginx/trixie,now 1.26.3-3 amd64 [installed]For a broader search, pipe the installed package list to grep :
apt list --installed 2>/dev/null | grep '^nginx/'The 2>/dev/null suppresses the apt stability warning that appears when piping. For scripts and repeatable exports, use dpkg-query because its formatted output is more stable.
Show the Installed Version
To print only the installed version of a package, use dpkg-query:
dpkg-query -W -f='${Version}\n' nginx1.26.3-3If you want the package description, dependencies, and repository metadata, use apt show nginx.
List Installed Packages with dpkg-query
The dpkg-query command queries the dpkg database directly and offers more formatting options than apt.
To list all installed packages:
dpkg-query -l||/ Name Version Architecture Description
+++-==============-==============-============-=================================
ii adduser 3.152 all add and remove users and groups
ii apt 3.0.3 amd64 commandline package manager
ii base-files 13.8+deb13u5 amd64 Debian base system misc files
ii bash 5.2.37-2+b9 amd64 GNU Bourne Again SHell
...The ii at the beginning of each line means the package is installed. The columns show the package name, version, architecture, and a short description.
To check a specific package:
dpkg-query -l nginxCustom Output Format
You can control the output format with the -f option. For example, to print only package names and versions:
dpkg-query -W -f='${binary:Package} ${Version}\n'For an installed-only package name list, include the dpkg status abbreviation and filter for ii, which means the package is installed:
dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | awk '$1 == "ii" { print $2 }'List Manually Installed Packages
The apt-mark showmanual command lists packages marked as manually installed, excluding packages marked as automatic dependencies:
apt-mark showmanualThis is particularly useful when you want to recreate your system on a new machine. Manual packages are a better starting point than every dependency, but the list can include base packages marked manual during installation.
Export and Restore Package Lists
To save only manually installed packages to a file:
apt-mark showmanual > manual-packages.txtTo install those packages on another Debian system:
sudo apt update
sudo xargs -a manual-packages.txt apt installThis installs fewer packages and lets apt resolve dependencies automatically.
If you need a full installed package list for auditing, export installed package names with dpkg-query:
dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | awk '$1 == "ii" { print $2 }' > packages.txtRestoring a full package list works best on the same Debian release and architecture with the same repositories enabled. Packages may fail to install on a different release if names changed, packages were removed, or third-party repositories are missing.
View Install History
The current package list tells you what is installed now, but sometimes you need to see when packages were installed or upgraded. Debian records APT actions in /var/log/apt/history.log:
less /var/log/apt/history.logOlder logs may be compressed. Use zgrep to search all history files for install actions:
zgrep "^Install:" /var/log/apt/history.log*Count Installed Packages
To find out how many packages are installed on your system, count packages whose dpkg status is ii:
dpkg-query -W -f='${db:Status-Abbrev}\n' | awk '$1 == "ii" { count++ } END { print count }'487To count only manually installed packages:
apt-mark showmanual | wc -lTroubleshooting
apt prints a warning about unstable CLI output
This warning appears when using apt in scripts or piped commands. For scripted exports and automation, prefer dpkg-query because its output format is more stable.
Some packages fail to install on the new system
The destination system may use different repositories, architecture, or release versions. Run sudo apt update, verify your enabled repositories, and install missing third-party repositories before replaying the package list.
xargs restore command fails with permission errors
Package installation requires administrative privileges. Use sudo with the install command and ensure your user has sudo access.
FAQ
What is the difference between apt list and dpkg-query?apt list --installed provides a user-friendly output with release channel information. dpkg-query queries the dpkg database directly and offers more control over the output format. Both show the same installed packages.
How do I check the version of an installed package?
Use apt list --installed package_name or dpkg-query -W -f '${Version}\n' package_name to display the installed version.
What does [installed,automatic] mean in the apt list output?
It means the package was automatically installed as a dependency of another package, not explicitly requested by the user.
How do I list packages that need updates?
Run apt update to refresh the package list, then use apt list --upgradable to see packages with available updates.
How do I remove a package from the system?
Use apt remove package_name to remove the package while keeping its configuration files, or apt purge package_name to remove everything including configuration files.
Conclusion
You can list installed packages on Debian using apt list --installed for a quick overview, dpkg-query for custom formatting, and apt-mark showmanual for packages marked as manually installed. Export the manual list when rebuilding a system, and use the APT history log when you need to see when packages were installed or upgraded.
For more package management commands, see the guide on using the apt command .
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

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