The apt command is an essential tool, created by Debian, used to manage packages in Debian, Ubuntu, Linux Mint, and other derivative distributions. In this tutorial, we will learn how to use the apt
command to list the installed packages in Ubuntu.
Listing Installed Packages
Example 1. To list installed packages with apt
, execute:
$ sudo apt list --installed
Example 2. You can also pipe to the less
command to show a more manageable output:
$ sudo apt list --installed | less
Example 3. Use the grep
command to filter out a specific package name and see if it’s installed:
$ sudo apt list --installed | grep package_name
List Upgradable Packages
Example 1. List the packages that are due for an update with the following command. First, you should update the repository cache:
$ sudo apt update $ sudo apt list --upgradable
Example 2. Pipe to the grep
command to search for a specific upgradeable package:
$ sudo apt --upgradable | grep package_name
Searching For an Installed Package
Example 1. To search for an installed package, execute:
$ apt search package_name
Example 2. The next syntax will allow you to search if the given package name is installed or not on your system:
$ sudo apt list -a package_name
Count the Packages Installed on Ubuntu
See a total number of packages installed on your system by executing this command:
$ sudo apt list --installed | wc -l