One of the several duties of a Linux administrator is to manage and keep track of the installed packages on a system.
In the Ubuntu system, you can install a package through different methods which involve installation through apt, dpkg, and snap.
Ubuntu also comes with a lot of packages pre-installed on it.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux related tasks.
In this context, we shall look into how to list all the installed packages on Ubuntu including the packages which come preinstalled and those which were manually installed.
Here, we will be dealing on the following areas:
1. List installed packages using apt command
2. List installed packages using dpkg command
3. List installed snap packages
4. Count installed packages
Apt is a command-line package management tool for Debian based Linux distributions that is used to install, update, and remove the packages from a system. With apt, you can list the installed packages on a system.
To list the installed packages in Ubuntu using the apt command, issue the following command in Terminal:
$ sudo apt list --installed
Now enter the password for sudo, after which it displays a long list of the installed packages in alphabetical order.
The list will include the packages that were installed through dpkg and apt commands. This list also includes the dependencies.
The packages displayed in the list also includes the version information of the installed packages.
As the displayed list is so long, it is a little hard to find a specific package.
If you need to verify whether a specific package is installed or not, you can pipe the output of the above command to grep as follows:
$ apt list --installed | grep package_name
For example, to check whether the Apache server is installed or not, issue the following command in Terminal:
$ apt list --installed | grep apache
Dpkg is also used for installing, building, and removing packages in Debian based OS. It can also be used to list installed packages in a system.
To list the installed packages in Ubuntu using the apt command, issue the following command in Terminal:
$ dpkg --list
Now enter the password for sudo, after which it displays a long list of all the installed packages in alphabetical order.
The packages displayed in the list also includes the version information of the installed packages.
As the displayed list is so long, it is a little hard to find a specific package. If you need to verify whether a specific package is installed or not, you can pipe the output of the above command to grep as follows:
$ dpkg --list | grep package_name
For example, to check whether the Apache server is installed or not, issue the following command in Terminal:
$ dpkg --list | grep apache
The above-described methods list the packages that were installed using apt and dpkg. It does not include the packages that were installed as snaps.
To list installed snap packages in Ubuntu, issue the following command in Terminal:
$ snap list
It will list all the snap packages installed on your system.
If you want to check whether a specific package is installed or not, you can pipe the output of the above command to grep as follows:
$ snap list | grep package_name
For example, to check whether the Skype package is installed or not, issue the following command in Terminal:
$ snap list | grep skype
You can also count the number of installed packages on your Ubuntu system. Issue the following command to do so:
$ dpkg --list | grep -v "^Listing" | wc --lines
This article covers how you can list installed packages on Ubuntu 20.04 LTS system. Also, you can also filter a specific package from the list and count the number of installed packages on your system.
You can list all installed packages with apt command or apt-get command on Ubuntu Linux.
You need to use the apt or apt-get or dpkg command to list all installed packages on an Ubuntu Linux server from the bash shell prompt.
To see what packages are installed on Ubuntu Linux:
1. Open the terminal application or log in to the remote server using ssh (e.g. ssh user@sever-name).
2. Run command apt list --installed to list all installed packages on Ubuntu.
3. To display a list of packages satisfying certain criteria such as show matching apache2 packages, run apt list apache.
To List all installed packages only:
The apt command displays both installed and packages available to install:
$ apt list --installed
To list or find out if a specific package installed or not:
Run package policy as follows:
$ apt list -a pkgNameHere