Reading Package Repositories

Reading Package Repositories

We can view all of the managed package repositories with the apt CLI by using the list argument.

apt list

apt list

There are so many package repositories they exceed the number of lines our terminal will render significantly.

Bonus

You can redirect the output from the apt list command directly into less by using the Bash Pipe operator (|). You would need to enter: apt list | less. This gives us the ability to manually scroll through the entire list. We will learn more about various Bash operators in a future article.

The Source of apt list

Everything is a file in Linux. So let’s look for the source of the apt list command.

sudo find /etc -name apt

sudo find /etc -name apt

Let’s take a look inside the /etc/apt directory.

ls /etc/apt

ls /etc/apt

There’s a few things here. But let’s take a look at /etc/apt/sources.list.

cat /etc/apt/sources.list

cat /etc/apt/sources.list

The /etc/apt/sources.list file contains some important statements that are directing the APT package manager on where to find the list of packages!

Note

Many of the lines of this file are commented out with the number sign (#). Some of these are comments explaining the various sections, and some of them are alternate lines you could use instead. There’s even an interesting section that reads: uncomment for additional repositories Additional repositories that can be easily added by uncommenting some lines! We won’t be using any of the packages from that repository in this class, but feel free to follow the link to get an idea of the available packages.

User Added Repositories

If you were to add repositories outside of the base Ubuntu repositories you would do so in the /etc/apt/sources.list.d directory.

Note

We will see an example of this in the Adding Additional Repositories section.

Ubuntu Packages Website

Accessing the external documentation is always a good idea.

Trying to wrap our head around all of the package repositories on our machine is a daunting task.

Let’s take a look at the Ubuntu Packages Homepage .

It provides a list of various Ubuntu versions, we are using 22.04 the canonical name is jammy.

Bonus

If you have forgotten your version of Ubuntu there are many ways to figure it out from your computer. There is a lsb_release command that displays distribution specific information. Try running lsb_release -a from your Bash shell: lsb_release -a

Upon looking at the webpage for the <code>jammy</code> repositories we can see they are organized by easier to digest sections.