In Ubuntu the /etc/apt/source.list file is a configuration file for Advance Packaging Tool (APT). This file saves all URLs for remote repositories from where software packages and applications are installed.
When you install any software using the apt install or apt-get install then the apt tool looks inside the file /etc/apt/sources.list for the available remote repository links. And then it searches for the required software from that available remote repository and starts the download and installs it.
You can add, delete and modify the remote repositories directly from the /etc/apt/sources.list file. Just follow the below methods to edit /etc/apt/sources.list file in your Ubuntu system.
Edit /etc/apt/sources.list File
First backup the /etc/apt/sources.list using the below command. Open the terminal app (ctrl+alt+t) and run
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
You can edit that file using GUI and command-line methods.
Edit /etc/apt/sources.list GUI Method:
In terminal run this command. It will open the /etc/apt/sources.list file in gedit text editor.
sudo gedit /etc/apt/sources.list
Here you can add, edit and delete the remote repositories details.
Edit /etc/apt/sources.list CLI Method:
You can edit the file using the command line editor nano using below command in terminal app.
sudo nano /etc/apt/sources.list
This will open that file nano cli editor. make the necessary changes and save it. That’s all.