How to Use the apt Command to List Installed Packages on Ubuntu?

How To Use The Apt Command To List Installed Packages On Ubuntu (1)

Let’s find out how we can use the apt command to list installed packages on Ubuntu/Debian. Packages help in delivering or installing any application on a Linux running system. Essentially, packages are nothing but a compressed archive of the files and dependencies required to install a program or service. These packages are used when a user wishes to install a new program or service on their system. All the packages on a system are stored in a local ‘repository’.

This repository can be accessed by a package management service as and when required. This package management service required for the user to access, modify, and install required packages.

Setting the Context

This tutorial was made with an Ubuntu 18.04 running system. However, the same instructions should work on Ubuntu 16.04 and Debian based distributions like Elementary OS, Linux Mint and Debian.

What’s the apt Command?

The Advanced Package Tool, Or ‘APT’ for short, is the package management service for Ubuntu and Debian based systems. If you have been using Linux for a while, you must have seen the apt command before. The APT was designed to provide a user-friendly, interactive front-end tool for the users to manage packages without the complexity of the dpkg command. APT is responsible for installing, updating, removing and managing packages of Ubuntu and Debian based systems.

The APT can be used through the command line using the ‘apt’ command. While we get a wide range of functionality with the apt command in Linux, with this tutorial we will focus on one aspect: listing the installed packages using the apt command.

Using the apt command to list installed packages on Ubuntu

When we wish to use a program or service on our Linux system, we need to know if the required packages are already installed or require installing. In such an instance, we need to take help of the ‘list’ function of the apt tool. As the name suggests, we use the list function of the apt command to list the packages available on our system

Using the apt list command

Our local repository contains all the packages which come with the Linux distribution running on our system, along with ones which we may have downloaded over time. With such a huge number of available packages, it is tough to remember if a package is available to us or not.

But we don’t need to worry, because the apt list command in Linux is designed to list all the available packages present in our repository. This is how the command looks.

apt list
Apt List apt command to list installed packages on ubuntu
Apt List

Listing only installed packages

If you noticed, the apt list command lists all the available packages in our repository. But what if you wish to only see the packages which are installed on your system? For this, we use the –installed option with our command. Now our command will return all the packages which are installed on our Ubuntu machine. This is how to use this command on Ubuntu.

apt list --installed
Apt List Installed
Apt List Installed

Verifying whether a particular package is installed

You now know how to list installed packages on your system. But what is the need for going through a list of packages to find out whether a package is installed? When you know the name of a package, you can simply use the ‘-a’ option with the apt list command. When this is followed by the name of a package, the output will tell you if the package is installed. Here is the syntax for the command.

apt list -a [package name]
Apt List Specific Package
Apt List Specific Package

As you can see, both sudo and adduser packages are installed on our system.

Wrapping up

Linux based systems utilise packages for installing and running all kinds of applications and services. This makes it essential for a Linux user to be able to manage and keep a note of all the available packages in their local repository. Remembering all the installed packages is not possible for us. But thankfully, the apt command brings us utilities to help us list installed packages and check if a particular package is installed on our system.

We hope this tutorial was able to help you understand how to use the apt command to list installed packages on Ubuntu. If you have any feedback, queries or suggestions, feel free to reach out to us in the comments below.