Introduction
Ubuntu is a popular Linux-based operating system that is used by many people around the world. It is a great platform for developers and users alike, and it comes with a wide range of packages and applications that can be installed. Knowing how to list installed packages on Ubuntu is a useful skill for anyone who uses the operating system. In this guide, we will discuss how to list installed packages on Ubuntu, as well as how to search for specific packages. We will also discuss how to remove packages that are no longer needed.
How to List Installed Packages on Ubuntu
1. Open the Terminal.
2. Type the following command to list all installed packages on your Ubuntu system:
sudo dpkg –get-selections
3. To list only the installed packages, type the following command:
sudo dpkg –get-selections | grep -v deinstall
4. To list only the installed packages with their version numbers, type the following command:
dpkg-query -W -f=’${Package} ${Version}
‘
Introduction
Ubuntu and other Linux-based systems use client applications to manage software directly. Some software packages come preinstalled by default, while system administrators install other packages when necessary.
Depending on which package manager installed the software, there are various ways to list installed packages on Ubuntu.
This tutorial teaches you to list the installed packages on an Ubuntu system.
Prerequisites
- A Debian-based distribution such as Ubuntu.
- A command line/terminal window (CTRL+ALT+T).
- The apt, dpkg, or snap package manager.
List Ubuntu Packages Using apt
By default, newer Ubuntu versions (14.04 or newer) come with the apt package manager. The package manager helps conduct operations relating to software packages.
List All Installed and Available Packages
Use the following command to list all installed and available packages on Ubuntu:
apt list
The output shows a long list of packages with the version information and the package architecture. Shorten the list by piping the less
command:
apt list | less
Navigate through the list by pressing the up or down arrow keys or space to skip to the next page. Press q to exit the viewer.
List Only Installed Packages
To list only installed packages, run:
apt list --installed
The --installed
tag ensures only installed packages show on the list. Each installed package has one of the following tags:
- [installed] indicates the package installed manually from the repository list.
- [installed, automatic] means the package installed automatically as a dependency for another installation.
- [installed, local] indicates the package is not from the official repository list.
List Specific Packages
There are three different ways to list a specific package:
1. Add the package name to the apt list
command to fetch a specific package from the list:
apt list <package name> --installed
Omit the --installed
tag to fetch a package, regardless of installation.
2. Combine apt list
with the grep
command to match a package by name:
apt list --installed | grep -i <package name>
The -i
tag ignores letter casing, providing a broader search.
3. Another way to get package information is to use the apt show
command:
apt show <package name>
The command shows the package details, including installation information.
List Upgradable Packages
To list packages with available upgrades, run the following command:
apt list --upgradable
The --upgradable
tag filters packages and lists only the ones ready for an upgrade.
Note: If you’ve upgraded recently, the list is empty.
Count the Number of Installed Packages
Use the apt list
command with the Linux wc command to count the number of lines:
apt -qq list --installed | wc -l
The -qq
tag quiets the output. Use the marker to ensure no additional lines print to the console and enter the count number.
List Ubuntu Packages Using dpkg
The dpkg package manager is included in earlier Ubuntu versions when apt is unavailable.
To list installed Ubuntu packages using the dpkg
command, run:
dpkg --get-selections | grep -w "install"
Alternatively, use the dpkg-query
tool:
dpkg-query -l | grep ii
In both cases, the output shows a long list of installed packages.
Create a List of all Installed Packages
To save the installed package names into a text file, use the following command:
dpkg --get-selections | grep -w "install" | cut -f1 > packages_list.txt
The cut command filters the output to only get the first column with the package names and saves the contents to a text file.
Count the Number of Installed Packages
Use the wc
command to count the number of lines from the list of installed packages:
dpkg --get-selections | grep -w "install" | wc -l
The -l
tag counts the number of lines from the dpkg --get-selections
output.
List Installed Packages Sorted by Date and Time
The dpkg logs store the date and time for package installations. To fetch all the information from log files, use the following command:
The output shows the exact timestamp for installed packages. The logs are archived and deleted after a specific time, so the list is not comprehensive.
List Installed Snap Packages
Snap is an alternative package manager system. The previous commands do not show packages installed through Snap.
To list installed Snap packages, run:
snap list
Note: Learn about the differences between the Snap packaging system and the apt package manager in Snap vs. Apt.
Conclusion
By following this guide, you should have learned how to list installed packages on Ubuntu and other Debian-based systems. If there is a problem with the installed packages, read our article on fixing broken packages in Ubuntu.
How to List Installed Packages on Ubuntu
Ubuntu is a popular Linux-based operating system that is used by millions of people around the world. It is a great platform for developers and users alike, and it is easy to install and manage packages on Ubuntu. In this article, we will show you how to list installed packages on Ubuntu.
Using the apt Command
The apt command is the most commonly used package manager on Ubuntu. It is used to install, remove, and manage packages on Ubuntu. To list all installed packages on Ubuntu, you can use the following command:
sudo apt list --installed
This command will list all the packages that are currently installed on your system. You can also use the following command to list only the packages that were installed from the official Ubuntu repositories:
sudo apt list --installed | grep '^ii'
Using the dpkg Command
The dpkg command is another package manager that is used to manage packages on Ubuntu. To list all installed packages on Ubuntu, you can use the following command:
sudo dpkg --list
This command will list all the packages that are currently installed on your system. You can also use the following command to list only the packages that were installed from the official Ubuntu repositories:
sudo dpkg --list | grep '^ii'
Conclusion
In this article, we have shown you how to list installed packages on Ubuntu. We have shown you two different methods, using the apt and dpkg commands. We hope this article has been helpful and you now know how to list installed packages on Ubuntu.