Advertisement

Main Ad

How to edit Kali Linux Repositories/Sources (apt sources.list) using Gedit or Leafpad

How many times have you messed-up your Kali Linux repositories/sources list? How many times you forgot how to edit the list using a text editor (available in Kali Linux)? It happened a lot of times to me so, I'll just keep this as a note for myself.
My repositories list contains only two lines of text. In case you've changed it and need to get it back to the "original" version, below is a small tutorial on how to edit your sources.list file. I'll cover both Gedit and Leafpad options.

In order to open your sources.list file with gedit, type the below command in the console:
sudo gedit /etc/apt/sources.list
Once the sources.list file is opened, make sure that you have these two lines in it:

deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
If these two lines are not present, feel free to copy & paste them - don't forget to save your file before closing it.







In order to open your sources.list file with leafpad, type the below command in the console:

sudo leafpad /etc/apt/sources.list



Once the sources.list file is opened, make sure that you have these two lines in it:

deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib

That’s it, you should now have access to most of the packages. Once you save the file, don't forget to execute the following commands:

apt-get update
apt-get upgrade
apt-get dist-upgrade

And you’re good to go. For more information & sources, please visit: https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/.