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
There are so many package repositories they exceed the number of lines our terminal will render significantly.
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
Let’s take a look inside the /etc/apt
directory.
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
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!
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:
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.
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
.
Upon looking at the webpage for the <code>jammy</code> repositories we can see they are organized by easier to digest sections.