Whenever you add a new repository on Ubuntu, the system adds a record to the sources.list file.
What other information related to repositories does this file contain? And is it important for the operating system to store this data? You'll find out in this post.
What Is the sources.list File?
As you might already know, repositories are responsible for providing packages to the users on Linux. Ubuntu and other Debian-based distributions use the sources.list file to keep a record of all the repositories present on a system.
The sources.list file contains repository details, with each uncommented line representing a separate repository.
Every line in the sources.list file follows a common format:
deb https://repository.url distro type
The first field denotes the type of package provided by the repository. On Debian and Ubuntu, you'll find one of these two archive types: deb and deb-src. By default, Ubuntu disables the repositories that provide deb-src packages.
The second field is reserved for the repository URL. This URL points to the server that stores all the package files along with the database.
The third field denotes the release code name for the version of your Ubuntu installation. You might find xenial, bionic, and focal in the case of Ubuntu, and buster or sid if you're using Debian.
The fourth entry contains information about the type of repository. On Ubuntu, the fourth field would contain any of these four repository components: main, restricted, universal, and multiverse.
Managing Repository Information on Linux
Adding repository information manually into the sources.list file is not a recommended practice. Instead, you should use the add-apt-repository command as it is safer and reliable. It also ensures that you do not add anything unrelated to the content of the file.
On Linux, you can add and remove packages independently as you wish. In fact, software management is one of the many things that Ubuntu does better than Windows.