Table of Contents >> Show >> Hide
- Why You Might Need to List Installed Packages on Ubuntu
- Understanding Ubuntu Package Managers
- Quick Method: List Installed Packages with apt
- Reliable Method: List Packages with dpkg
- Best for Scripts: Use dpkg-query
- List Only Manually Installed Packages
- Export a Complete Installed Package List
- List Snap Packages on Ubuntu
- List Flatpak Applications
- Find Recently Installed Packages
- Find Which Package Installed a File
- List Files Installed by a Package
- Practical Command Cheat Sheet
- Common Mistakes When Listing Ubuntu Packages
- How to Reinstall Packages from a Saved List
- Best Practices for Ubuntu Package Inventory
- Real-World Experience: Lessons from Listing Ubuntu Packages
- Conclusion
Note: This publishing-ready guide is based on current Ubuntu package-management behavior, Debian/Ubuntu command documentation, Snap package guidance, and practical Linux administration workflows.
At some point, every Ubuntu user asks the same suspiciously simple question: “What exactly is installed on this machine?” Maybe your laptop has been through three LTS upgrades, five “quick tests,” and one mysterious weekend where you installed half the internet. Maybe you are preparing a new server and want to clone your software setup without playing package-name bingo. Or maybe your disk is full and you suspect a forgotten toolchain is living rent-free in /usr.
Good news: Ubuntu makes it easy to list installed packages. Slightly less good news: there is more than one kind of package list. A quick desktop check, a clean migration report, a list of manually installed packages, and a complete inventory for automation all use slightly different commands. This guide walks through the best ways to list installed packages in Ubuntu, including apt, dpkg, dpkg-query, snap, and flatpak. No wizard robe required.
Why You Might Need to List Installed Packages on Ubuntu
Listing installed packages is not just a nerdy hobby, although it is a perfectly respectable one. It is useful for real maintenance tasks. When you know what is installed, you can rebuild a system faster, compare two machines, audit software, remove unused packages, or document a production server before touching anything risky.
For example, if you are moving from Ubuntu 22.04 LTS to Ubuntu 24.04 LTS or preparing a fresh Ubuntu workstation, exporting a package list helps you recreate your environment. If you are troubleshooting dependency problems, the package list tells you whether the right library version exists. If you are cleaning a server, it helps identify software that was installed once for “testing” and then quietly became part of the furniture.
Understanding Ubuntu Package Managers
Before running commands, it helps to understand what you are listing. Ubuntu mainly uses Debian packages, commonly called .deb packages. These are managed by dpkg at the lower level and by APT tools such as apt at the higher level.
APT vs. dpkg: What Is the Difference?
dpkg is the local package manager. It knows what Debian packages are installed, removed, unpacked, or partially configured. It does not automatically fetch packages and dependencies from online repositories. APT sits above dpkg and makes package management friendlier by downloading packages, resolving dependencies, and handling upgrades.
Think of dpkg as the warehouse inventory system and apt as the helpful store clerk who knows which aisle everything is in. Both matter, but they serve different jobs.
What About Snap and Flatpak?
Modern Ubuntu systems may also include Snap packages. Snaps are managed separately from APT, so they do not appear in a normal dpkg package list. Some users also install Flatpak applications, which are managed by Flatpak and also live outside the APT database. That means a complete Ubuntu software inventory should usually check APT packages, Snap packages, and Flatpak apps when Flatpak is installed.
Quick Method: List Installed Packages with apt
The simplest command for most users is:
This displays installed APT packages in a readable format. You will usually see package names, versions, architecture, and whether a package was installed automatically. The output can be long. Very long. On a normal Ubuntu desktop, it may scroll like a grocery receipt from a family reunion.
To make the list easier to review, pipe it into less:
Now you can scroll up and down instead of watching your terminal become a waterfall.
Search Installed Packages with grep
If you only want to know whether a package family is installed, combine apt list --installed with grep:
The 2>/dev/null part hides warnings that APT may print when its output is used in scripts or pipes. For casual terminal use, the warning is not a disaster. For clean output, redirecting it keeps things tidy.
Other useful examples:
These commands help you check installed Python packages, MySQL-related packages, or Linux kernel image packages without digging through the entire list manually.
Reliable Method: List Packages with dpkg
For a deeper package-state view, use:
or the shorter form:
This command lists packages known to the local package database. It includes status codes at the beginning of each row. The most common one you will care about is ii, which means the package is selected for installation and currently installed.
Understanding dpkg Status Codes
A typical installed package line starts like this:
The first two letters are important. The first character represents the desired action, and the second represents the current package status. In everyday troubleshooting, ii is the happy little symbol you want to see. It means “yes, this package is installed.”
You may also see rc. That usually means a package was removed, but configuration files remain. This is not necessarily bad, but it is useful to know during cleanup.
Filter dpkg Output for One Package
To check whether Apache is installed, run:
To check OpenSSH server:
If the package appears with ii, it is installed. If nothing appears, the package may not be installed, or your search term may not match the exact package name.
Best for Scripts: Use dpkg-query
If you are writing a script, building documentation, or creating a clean report, dpkg-query is often better than apt list. It allows formatted output and avoids the human-focused extras that can make automation messy.
To list installed package names and versions:
For a custom report with package name and version:
This prints each package on its own line with a tab between the package name and version. That is excellent for text files, spreadsheets, comparison tools, and future-you, who will appreciate the organization.
Show Only Fully Installed Packages
For a cleaner list that checks package status, use:
This displays only packages whose status begins with ii. It is a practical command for audits because it avoids confusing installed packages with removed packages that still have leftover configuration files.
List Only Manually Installed Packages
Sometimes you do not want every dependency on the system. You want the packages you intentionally installed. For that, use:
This command prints packages marked as manually installed. These are packages APT understands as explicitly requested rather than pulled in automatically as dependencies.
Why does that matter? Suppose you installed nginx. APT may also install libraries and helper packages that Nginx needs. You usually do not want to copy every dependency into your “must reinstall” list. You want the main packages you chose, and then APT can resolve dependencies again on the new system.
Save Manually Installed Packages to a File
To create a file:
To view it later:
This is useful before reinstalling Ubuntu or setting up another machine. Still, review the file before using it. Some base packages may be marked manual depending on installation history, upgrades, or system configuration. In other words, do not blindly copy the list like it is a sacred tablet from Mount Terminal.
Export a Complete Installed Package List
To export a full list of installed APT packages, use:
For a more script-friendly version:
The second command creates a tab-separated file, which is easier to compare, parse, or import into a spreadsheet.
Compare Package Lists Between Two Ubuntu Systems
On each machine, run:
Copy both files to one machine, then compare them:
This shows packages that differ between the two lists. It is especially useful when one server behaves perfectly and the other behaves like it was assembled during a lightning storm.
List Snap Packages on Ubuntu
APT and dpkg do not show Snap applications. To list installed snaps, run:
The output typically includes the snap name, version, revision, tracking channel, publisher, and notes. For example, you may see entries such as firefox, snapd, or core runtime snaps.
Show All Snap Revisions
To show all revisions, including disabled ones, use:
This can reveal older revisions kept by Snap. If you are investigating disk usage, this command is worth running because disabled revisions may still consume space.
List Flatpak Applications
Flatpak is not installed by default on every Ubuntu setup, but many desktop users add it for applications from Flathub or other remotes. If Flatpak is installed, list apps with:
To list runtimes as well:
Flatpak apps and runtimes are separate from APT packages. If you are documenting all installed software on Ubuntu, remember to include Flatpak output. Otherwise, your inventory may miss major desktop applications.
Find Recently Installed Packages
If your system changed recently and you want to know what happened, check package logs. For APT history, try:
For older compressed logs:
You can search for install events:
For dpkg logs:
These logs are excellent when you installed “just one thing” and suddenly six hundred megabytes of dependencies appeared. Linux is honest, but it does enjoy bringing friends.
Find Which Package Installed a File
Sometimes the question is not “what packages are installed?” but “where did this file come from?” Use:
Example:
This tells you which installed package owns that file. It is useful when investigating configuration files, binaries, libraries, or mysterious system artifacts.
List Files Installed by a Package
To see all files installed by a package, run:
Example:
This shows files placed on the system by the package. It does not include every file an application may generate later, such as logs, caches, user preferences, or runtime data.
Practical Command Cheat Sheet
For Quick Human Review
For Package State
For Script-Friendly Output
For Manually Installed Packages
For Snap Packages
For Flatpak Apps
For Recent APT Installs
Common Mistakes When Listing Ubuntu Packages
Assuming apt Shows Everything
apt list --installed is useful, but it does not list Snap or Flatpak applications. If your Ubuntu desktop uses Firefox as a snap, or if you installed apps through Flatpak, they require separate commands.
Using apt Output in Scripts Without Caution
The apt command is designed mainly for interactive use. For scripts, prefer dpkg-query with a defined output format. Your automation will be cleaner and less likely to break because of formatting changes.
Confusing Manual Packages with User-Installed Apps
apt-mark showmanual is helpful, but it is not a perfect diary of everything you personally clicked or typed. Some packages may be marked manual because of the installer, upgrades, metapackages, or previous maintenance. Treat it as a strong clue, not courtroom evidence.
Ignoring Removed Packages with Leftover Configs
When using dpkg -l, packages marked rc are no longer installed but still have configuration files. These can matter when cleaning a system or reinstalling software because old configs may influence future behavior.
How to Reinstall Packages from a Saved List
If you saved a manual package list, you can reinstall packages on another Ubuntu system with:
However, review the list first. Some packages may no longer exist in the new Ubuntu release, may have changed names, or may come from third-party repositories that are not enabled on the new system.
A safer workflow is:
Editing the file gives you a chance to remove old kernels, obsolete packages, experimental tools, or that one package you installed at 2:13 a.m. because a forum post said it “might help.”
Best Practices for Ubuntu Package Inventory
For a complete inventory, save separate files:
This creates a practical snapshot of your system. The Flatpak command redirects errors so the script does not look alarming on machines without Flatpak installed.
For servers, store the inventory with your deployment notes. For workstations, keep it in your backup folder. For production systems, consider committing package lists to a private infrastructure repository so changes are visible over time.
Real-World Experience: Lessons from Listing Ubuntu Packages
In real Ubuntu maintenance, listing packages is rarely just about curiosity. It is usually the first step before doing something important. Over time, a package list becomes like a system’s medical chart. It tells you what has been added, what depends on what, and where surprises may be hiding.
One practical lesson is that the “best” command depends on the question. When helping a beginner check whether a package is installed, apt list --installed | grep package-name is friendly enough. The output is readable, and the user can quickly see the package name and version. But when building a migration script, apt list is not the ideal tool. dpkg-query is cleaner because it gives predictable fields that are easier to sort, compare, and process.
Another lesson is that manually installed package lists are useful but imperfect. On a fresh-looking system, apt-mark showmanual may include packages the user never consciously selected. Ubuntu installers, desktop metapackages, drivers, language support, and release upgrades can influence what is marked manual. That does not make the command bad. It simply means you should review the output before using it to rebuild another machine.
Package lists are also excellent troubleshooting tools. Suppose an application works on one Ubuntu server but fails on another. Export the package lists from both systems, sort them, and compare them. Differences in library versions, missing helper tools, or absent modules often jump out quickly. This approach is faster than guessing and much better than installing random packages until the problem either disappears or evolves into a larger problem wearing sunglasses.
For desktop users, the biggest surprise is usually Snap and Flatpak. A user may say, “I listed installed packages, but Firefox is missing.” On newer Ubuntu desktops, Firefox may be installed as a snap. That means dpkg is not the source of truth for that application. The same applies to Flatpak apps installed from Flathub. A complete inventory must into a larger problem wearing sunglasses.
For desktop users, the biggest surprise is usually Snap and Flatpak. A user may say, “I listed installed packages, but include multiple package managers because modern Linux software does not all live in one neat little box.
Disk cleanup is another common use case. Users often run dpkg -l and notice rc packages. These are removed packages with configuration files left behind. Keeping configuration files is helpful when you might reinstall the software later, but old configs can clutter package reports. Before deleting anything, check what the package was and whether the configuration still matters. Cleanup should be careful, not heroic.
For servers, package inventory should be part of routine administration. Before major upgrades, capture APT packages, manual packages, Snap packages if used, repository files, and important configuration directories. If something goes wrong, this information can save hours. It turns “I think we had some PHP modules installed” into a documented list. Future administrators will thank you, possibly with coffee.
For personal laptops, package lists are great before reinstalling Ubuntu. Many users reinstall the operating system and then spend days remembering missing tools: Git, VLC, curl, build-essential, GIMP, fonts, codecs, VPN clients, database tools, and that one screenshot utility they suddenly cannot live without. Saving a manual package list before reinstalling makes recovery much smoother.
The final experience-based tip is simple: label your exports. A file named packages.txt is fine for five minutes. Six months later, it becomes a mystery artifact. Use names like ubuntu-2404-thinkpad-apt-manual-2026-06-11.txt. It looks excessive until the day you need it. Then it looks beautiful.
Conclusion
Listing installed packages on Ubuntu is easy once you choose the right command for the job. Use apt list --installed when you want a quick readable list. Use dpkg -l when package status matters. Use dpkg-query when you need clean, script-friendly output. Use apt-mark showmanual when you want packages marked as manually installed. And do not forget snap list or flatpak list --app if your system uses Snap or Flatpak applications.
A good package inventory can help you migrate systems, troubleshoot problems, document servers, compare machines, and clean up old software. It is one of those small Linux skills that quietly pays rent forever. Your Ubuntu system already knows what is installed; these commands simply ask it politely.
