How to list all packages in the repository on Ubuntu, Debian or Linux Mint [APT]

This article explains how to list all available packages in Ubuntu, Linux Mint or Debian repositories (installed and ready to install), whether it is an official repository or a third-party resource (such as PPA), etc.
Below, you will find two ways to list packages from the repository: using the GUI or from the command line.
From the same series:

  • How to prevent packages from being updated in Ubuntu, Debian or Linux Mint [APT]
  • How to search for available packages from the command line in Debian, Ubuntu or Linux Mint [APT]

Use the GUI to list all packages in the Debian, Ubuntu or Linux Mint repository

If you want to list all the packages in the repository on the desktop, you can use the Synaptic package manager.
Synaptic is APT’s graphical package management application (APT is the main command-line package manager for Debian and its derivatives).
If Synaptic is not installed, you can use the following command to install it on Debian, Ubuntu, and any Linux distribution based on Debian or Ubuntu, including the basic OS, Linux Mint, etc .:

sudo apt install synaptic

To use Synaptic to list all packages in a specific software repository, launch the application and click Origin At the bottom left of its window. Next, select the repository where you want to list all available packages (installed and available for installation) from the list displayed on the left side of Synaptic Package Manager.
For example, the following Synaptic shows all available packages in the Google repository, listing Google Chrome stable, beta and unstable versions, as well as Google Earth Pro and EC:

As you can see, all software resources are listed here, including the official resource library.
Launchpad PPA repository is also supported. Their names begin with LP-PPA and then the actual PPA name. Synapse lists 2 entries for each PPA-make sure to select PPA entries ending in PPA /ubuntu-codename, E.g /bionic, /cosmic,and many more. /now Not all available packages in PPA are listed.
This is a screenshot showing all available packages in the Ubuntu graphics driver PPA (for Ubuntu 18.10 Cosmic Cuttlefish, because this is the package I am using), including the packages installed on the display system:
Synapse lists all packages in the repository

I’m not sure why, but some packages list PPA sources multiple times (and only for PPA repositories). It was just a display thing, and did not break any function.

List all packages in the repository in Ubuntu, Debian or Linux Mint from the command line

Listing all the packages in the repository from the command line of Ubuntu, Debian or Linux Mint is a bit tricky, but it is still very easy to do.
There are multiple ways to do this through commands, but I only list one of them. Command to list all available packages repository-name Is the following:

grep ^Package /var/lib/apt/lists/repository-name*_Packages | awk '{print $2}' | sort -u

I will explain later how to find the repository name from /var/list/apt/lists And how to use it. Before that, I will explain the role of the command:

  • grep ^Package ... Search for lines that start with ^Package inside /var/lib/apt/lists/*_Packages file
  • awk '{print $2}' Print the second column of each line (so it will filter everything except the package name)
  • sort -u Sort rows and output only unique rows (remove duplicates)

The first thing you need to do is find the name of the repository *_Packages File from /var/lib/apt/lists/. You can list all repositories _Packages Available files /var/lib/apt/lists/ By using a simple ls:

ls /var/lib/apt/lists/*_Packages

Since the result may be very long, you can run the command output with the following command more For easier reading:

ls /var/lib/apt/lists/*_Packages | more

If you know part of the repository name (I am using KEYWORD As the name in the following command), you can filter ls Result use grep, like this:

ls /var/lib/apt/lists/*_Packages | grep KEYWORD

For example, suppose you want to list all packages in the official Tor repository, and know that the repository name must contain tor. In this case, you will use this command to find out _Packages File name from /var/lib/apt/lists/

ls /var/lib/apt/lists/*_Packages | grep tor

For short queries, some irrelevant repositories may be displayed, but it ’s still easy to see what to use grep Instead of listing all repositories _Packages file.
Now you know _Packages File name, you can list all the packages available in the repository by issuing the following command:

grep ^Package /var/lib/apt/lists/some-repository-amd64_Packages | awk '{print $2}' | sort -u

Use the file that contains the architecture for which you want to list all available software packages in the repository. The above example is for 64-bit (amd64), But you can use i386 Suitable for 32bit etc.
You don’t need a complete repository _Packages file name. Back to my Tor repository example, _Packages Tor’s file name is deb.torproject.org_torproject.org_dists_cosmic_main_binary-amd64_Packages. In this case, you can use deb.torproject Followed by *_Packages Simplify things like this:

grep ^Package /var/lib/apt/lists/deb.torproject*_Packages | awk '{print $2}' | sort -u

Output the following:

another example. Suppose you want to view Linux Uprising Oracle Java 11 PPA (ppa:linuxuprising/java). You can list them using the following methods:

grep ^Package /var/lib/apt/lists/ppa.launchpad.net_linuxuprising_java*_Packages | awk '{print $2}' | sort -u

Output the following:


To use it with other PPA repositories, replace linuxuprising The first part of the PPA name, and java Using the second part of the PPA name, this command will list all the packages (installed and not installed) in the PPA.
You can also use the following method to list all packages available in all PPA repositories added on the system:

grep ^Package /var/lib/apt/lists/*_Packages | awk '{print $2}' | sort -u

For easy access, you can use the “Mark Commands” bookmark manager to bookmark this command (although it is mainly used for searching, HSTR can also add commands as bookmarks).